PDA

View Full Version : Numpy array?



filifunk
September 4th, 2009, 07:19 PM
Lets say you want to plot in matplotlib from a csv file of historical stock data the 1st and 8th column on a graph.

I tried this and it didn't work:



figure()
plot(values[[:,0], [:,7]])
show()

jpkotta
September 5th, 2009, 12:25 AM
Lets say you want to plot in matplotlib from a csv file of historical stock data the 1st and 8th column on a graph.

I tried this and it didn't work:



figure()
plot(values[[:,0], [:,7]])
show()


Looks like your subscripting syntax is wrong. You probably want something more like:


t = range(len(values[:,0]))
plot(t, values[:,0], t, values[:,7])