Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:55:55+00:00 2026-06-14T11:55:55+00:00

I have these data structures: X axis values: delta_Array = np.array([1000,2000,3000, 4000, 5000, 6000,

  • 0

I have these data structures:

  X axis values:
 delta_Array = np.array([1000,2000,3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000])

  Y Axis values
   error_matrix = 
 [[ 24.22468454  24.22570421  24.22589308  24.22595919  24.22598979
    24.22600641  24.22601644  24.22602294  24.2260274   24.22603059]
  [ 28.54275713  28.54503017  28.54545119  28.54559855  28.54566676
    28.54570381  28.54572615  28.54574065  28.5457506   28.54575771]]

How do I plot them as a line plot using matplotlib and python

This code I came up with renders a flat line as follows
figure(3)
i = 0

 for i in range(error_matrix.shape[0]):
  plot(delta_Array, error_matrix[i,:])

 title('errors')
 xlabel('deltas')
 ylabel('errors')
 grid()
 show()

The problem here looks like is scaling of the axes. But im not sure how to fix it. Any ideas, suggestions how to get the curvature showing up properly?

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:55:56+00:00Added an answer on June 14, 2026 at 11:55 am

    You could use ax.twinx to create twin axes:

    import matplotlib.pyplot as plt
    import numpy as np
    
    delta_Array = np.array([1000,2000,3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000])
    
    error_matrix = np.array(
        [[ 24.22468454, 24.22570421, 24.22589308, 24.22595919, 24.22598979, 24.22600641, 24.22601644, 24.22602294, 24.2260274, 24.22603059],
         [ 28.54275713, 28.54503017, 28.54545119, 28.54559855, 28.54566676, 28.54570381, 28.54572615, 28.54574065, 28.5457506, 28.54575771]])
    
    
    fig = plt.figure()
    ax = []
    ax.append(fig.add_subplot(1, 1, 1))
    ax.append(ax[0].twinx())
    colors = ('red', 'blue')
    
    for i,c in zip(range(error_matrix.shape[0]), colors):
        ax[i].plot(delta_Array, error_matrix[i,:], color = c)
    plt.show()
    

    yields

    enter image description here

    The red line corresponds to error_matrix[0, :], the blue with error_matrix[1, :].

    Another possibility is to plot the ratio error_matrix[0, :]/error_matrix[1, :].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these two data structures that I continually find myself choosing between when
I have a set of data with over 1000 entries. I can filter these
I have these two data structures: public TreeMap<String, Integer> tableFrequency; public SortedSet<Map.Entry<String, Integer>> sortedTable;
Concerning data binding I have these classes: public class Foo : List<Bar> { public
I have a DataTable which I select from database (Well, these data cross several
I have an Activity with 3 spinners. These spinners get their data from a
Suppose I have the following two data structures: std::vector<int> all_items; std::set<int> bad_items; The all_items
Suppose I have a bunch of Clojure data structures, all of the same type
.NET 4 includes new concurrent data structures. The Bag and Dictionary collections have obvious
I have these two structures in my domain: Exercise (with subjects, solution, difficulty ext.)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.