title: Python plots - I fixed this code, but need someone to explain how it worked in the first place
body: <p>I have the following python code: </p>
  
  <pre><code>def graph(seconds,now, dayold, threedayold,weekold):
      x = np.arange(len(seconds))
      ynow = np.array(now)
      yday = np.array(dayold)
      y3day = np.array(threedayold)
      yweek = np.array(weekold)
      # y2 should go on top, so shift them up
      plt.plot(x,ynow)
      plt.plot(x,yday)
      plt.plot(x,y3day,'purple')
      plt.plot(x,yweek)
      plt.fill_between(x,ynow,yday,color='lightblue')
      plt.fill_between(x,yday,y3day,color='green')
      plt.fill_between(x,y3day,yweek,color='purple')
      plt.fill_between(x,yweek,0,color='red')
      plt.show()
  </code></pre>
  
  <p>which produces this graph: </p>
  
  <p><img src="https://i.stack.imgur.com/d7aTx.png" alt="enter image description here"></p>
  
  <p>However, 'seconds' is a list of non-continues results and what I really want is: </p>
  
  <pre><code>def graph(seconds,now, dayold, threedayold,weekold):
      x = np.array(seconds)
      ynow = np.array(now)
      yday = np.array(dayold)
      y3day = np.array(threedayold)
      yweek = np.array(weekold)
      # y2 should go on top, so shift them up
      plt.plot(x,ynow)
      plt.plot(x,yday)
      plt.plot(x,y3day,'purple')
      plt.plot(x,yweek)
      plt.fill_between(x,ynow,yday,color='lightblue')
      plt.fill_between(x,yday,y3day,color='green')
      plt.fill_between(x,y3day,yweek,color='purple')
      plt.fill_between(x,yweek,0,color='red')
      plt.show()
  </code></pre>
  
  <p>So that I could get a proper X-Y plot.  However when I try the second bit of code I get this error: </p>
  
  <pre><code>josephs-mbp-3$Traceback (most recent call last):
    File "./temp.py", line 47, in &lt;module&gt;
      graph(a[0],a[1],a[2],a[3],a[4])
    File "./temp.py", line 41, in graph
      plt.fill_between(x,yweek,0,color='red')
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 2287, in fill_between
      ret = ax.fill_between(x, y1, y2, where, interpolate, **kwargs)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/axes.py", line 6489, in fill_between
      y2 = np.ones_like(x)*y2
  NotImplementedError: Not implemented for this type
  </code></pre>
  
  <p>Can anyone tell me what is causing this and how I fix it? </p>
  
  <p>EDIT: Ah-ha!  I fixed it, but would like someone to tell me how... </p>
  
  <p>Changing </p>
  
  <pre><code> plt.fill_between(x,yweek,0,color='red')
  </code></pre>
  
  <p>to </p>
  
  <pre><code>plt.fill_between(x,yweek,[0]* len(seconds),color='red')
  </code></pre>
  
  <p>produced what I wanted - and I can understand why this would be a problem,  but I'm confused as to why the first version worked at all... any ideas? </p>