title: Matplotlib Stackplot legend Error
body: <p>I am trying to include a legend for my stackplot.  I know that you cannot do it in the normal way so I followed the instructions from <a href="https://stackoverflow.com/questions/14534130/legend-not-showing-up-in-matplotlib-stacked-area-plot">this similar post</a> however there is still an error.</p>
  
  <pre><code>x=data[:,-1]
  y1=map(int,data[:,1])
  y2=map(int,data[:,2])
  y3=map(int,data[:,3])
  y4=map(int,data[:,4])
  y5=map(int,data[:,5])
  y6=map(int,data[:,6])
  y7=map(int,data[:,7])
  y8=map(int,data[:,8])
  y9=map(int,data[:,9])
  y10=map(int,data[:,0])
  
  xnew=np.linspace(0,len(x),50)
  
  smooth_y1=spline(np.arange(len(x)),y1,xnew)
  smooth_y2=spline(np.arange(len(x)),y2,xnew)
  smooth_y3=spline(np.arange(len(x)),y3,xnew)
  smooth_y4=spline(np.arange(len(x)),y4,xnew)
  smooth_y5=spline(np.arange(len(x)),y5,xnew)
  smooth_y6=spline(np.arange(len(x)),y6,xnew)
  smooth_y7=spline(np.arange(len(x)),y7,xnew)
  smooth_y8=spline(np.arange(len(x)),y8,xnew)
  smooth_y9=spline(np.arange(len(x)),y9,xnew)
  smooth_y10=spline(np.arange(len(x)),y10,xnew)
  
  plt.stackplot(np.arange(50),smooth_y1,smooth_y2,smooth_y3,smooth_y4,smooth_y5,smooth_y6,smooth_y7,smooth_y8,smooth_y9,smooth_y10)
  
  
  plt.ylim([0,30])
  plt.legend([smooth_y1,smooth_y2,smooth_y3,smooth_y4,smooth_y5,smooth_y6,smooth_y7,smooth_y8,smooth_y9,smooth_y10],['hfsdkjfhs','sldjfhsdkj','sdrtryf','sdfsd','sdkjf','sdfsd','sdrtdf','sfsd','sdaaafs','sdffghs'])
  plt.show()
  </code></pre>
  
  <p>However an error occurs on the line with the legend. It says </p>
  
  <pre><code>File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 3381, in legend
      ret = gca().legend(*args, **kwargs)
    File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 4778, in legend
      self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
    File "C:\Python27\lib\site-packages\matplotlib\legend.py", line 366, in __init__
      self._init_legend_box(handles, labels)
    File "C:\Python27\lib\site-packages\matplotlib\legend.py", line 606, in _init_legend_box
      handler = self.get_legend_handler(legend_handler_map, orig_handle)
    File "C:\Python27\lib\site-packages\matplotlib\legend.py", line 546, in get_legend_handler
      if orig_handle in legend_handler_keys:
  ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
  </code></pre>
  
  <p>Does anyone know how to solve this?</p>