0

Dear all,
I am using python and trying to plot the large scale of data as follows.

A  B    C  D  E
1  2    4  5  6 
2  3.1  5  1  8.
3  5    5  6  10.1 
4  8    9  7  13
5  11   13 12
6  18      19

Just like ABCDE, i have more number of columen about more than 50, and all i want to do is i want to plot all the column with base on A as X axix and all other in Y axis. here is the format i tried but i couldnt

f= open('open.txt','r')
for line in f:
     line = line.split()
     x = line[1]
     y = line[2]
     z = line[3]
     x1 =line[4]
     x2= line[5]
plt.plot(x,y)
plt.plot(x,y)
plt.plot(x,z)
plt.plot(x,x1)
plt.plot(x,x2)

Edited by pyTony: Title spelling

2
Contributors
1
Reply
4
Views
4 Years
Discussion Span
Last Post by pyTony
0

You are plotting same string from the last line twice and also you had x2 spelled originally with capital X. Maybe you should also plot other lines data, and maybe as numbers instead of string? Then you basically should convert to int or float each number after split and append them in a list instead of overwriting values from earlier lines.

Maybe this code snippet I posted could be also of interest to you?

Edited by pyTony

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.