Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is only a section of my function.

VB
y1 = np.genfromtxt(first_filename)
    y2 = np.genfromtxt(second_filename)
    y1 = np.array([y1])
    y2 = np.array([y2])
    x = [0,10,20,30,40,50]
    plt.plot(x, y1, x, y2)
    plt.title('Data')
    plt.xlabel('xlabel')
    plt.ylabel('ylabel')
    plt.show()


Currently, x and y don't have the same first dimension.
Posted
Comments
PythonHeadBanger 9-Nov-15 13:52pm    
Is this the correct indent block format? I feel like the indent is throwing me off. Is the first line meant to be unindented?

1 solution

Looks like you are using lists to feed Matplotlib....

You will need to turn the contents of the two files into lists and then feed them into Matplotlib....

Which means you will have to interpret the contents and find the values you want to use as a y1 and y2 values.

In the future it would be helpful to include a more complete code example and a more specific question: (courtesy include your imports, and specify the data format for the sourcefiles) (hey this code doesn't run?, or how do I get information out of multiple source files for MatPlotLib?)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900