title: Numpy index out of range error
body: <p>I'm using this code :</p>
  
  <pre><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)
  </code></pre>
  
  <p>but it's returning this :</p>
  
  <blockquote>
    <p>ax.plot(r.date, r.close)</p>
    
    <p>IndexError: index out of range for array</p>
  </blockquote>
  
  <p>How do I make sure that I`m staying inside the array range ?</p>
  
  <p>if I print out len(r.date) and len(r.close) they are both returning : 500</p>
  
  <hr>
  
  <p>EDIT, this is a sample code from matplotlib, using a npy file, I'd like to do the same for e CSV file :</p>
  
  <pre><code>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)
  </code></pre>
  
  <hr>
  
  <p>EDIT, full error log:</p>
  
  <pre><code>Traceback (most recent call last):
    File "main02.py", line 66, in &lt;module&gt;
      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
  </code></pre>