I'm using this code :
r = mlab.csv2rec(datafile, delimiter=';')
fig = plt.figure()
fig.subplots_adjust(bottom=0.2)
ax = fig.add_subplot(111)
ax.plot(r.date, r.close)
but it's returning this :
ax.plot(r.date, r.close)
IndexError: index out of range for array
How do I make sure that I`m staying inside the array range ?
if I print out len(r.date) and len(r.close) they are both returning : 500
EDIT, this is a sample code from matplotlib, using a npy file, I'd like to do the same for e CSV file :
datafile = cbook.get_sample_data('goog.npy')
r = np.load(datafile).view(np.recarray)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(r.date, r.adj_close)
EDIT, full error log:
Traceback (most recent call last):
File "main02.py", line 66, in <module>
ax.plot(r['date'], r['close'])
File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 3788, in plot
self.autoscale_view(scalex=scalex, scaley=scaley)
File "/usr/lib/python2.6/site-packages/matplotlib/axes.py", line 1824, in autoscale_view
y0, y1 = ylocator.view_limits(y0, y1)
File "/usr/lib/python2.6/site-packages/matplotlib/ticker.py", line 1170, in view_limits
return np.take(self.bin_boundaries(dmin, dmax), [0,-1])
File "/film/tools/PythonExtensions/v41/py26_linux-x64/numpy/core/fromnumeric.py", line 103, in take
return take(indices, axis, out, mode)
IndexError: index out of range for array

