I am trying to plot (x,y)
where as y = [[1,2,3],[4,5,6],[7,8,9]]
.
Say, len(x) = len(y[1]) = len(y[2])
..
The length of the y is decided by the User input. I want to plot multiple plots of y in the same graph i.e, (x, y[1],y[2],y[3],...)
. When I tried using loop it says dimension error
.
I also tried: plt.plot(x,y[i] for i in range(1,len(y)))
How do I plot ? Please help.
for i in range(1,len(y)):
plt.plot(x,y[i],label = 'id %s'%i)
plt.legend()
plt.show()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…