title: Matplotlib Legend Guide basic examples
body: <p>I am trying to understand how to use the legend() better, specifically how to use proxy artists. I find the <a href="http://matplotlib.org/users/legend_guide.html##using-proxy-artist" rel="nofollow noreferrer">Legend guide</a> to be severely lacking. This post is somewhat similar to <a href="https://stackoverflow.com/questions/25551467/typeerror-in-basic-example-for-legend-handles-in-matplotlib?answertab=votes">this one</a>.</p>
  
  <p>I am using Python 2.7.5 on Windows 7, matplotlib version 1.2.1. I wrote this code which is essentially a combination of the examples in the legend guide:</p>
  
  <pre><code>import matplotlib.patches as mpatches
  import matplotlib.lines as mlines
  import matplotlib.pyplot as plt
  
  line_up, = plt.plot([1,2,3], label='Line 2')
  line_down, = plt.plot([3,2,1], label='Line 1')
  
  blue_line = mlines.Line2D([], [], color='blue', marker='*',
                        markersize=15, label='Blue stars')
  red_patch = mpatches.Patch(color='red', label='The red data')
  plt.legend([red_patch,blue_line])
  
  plt.show()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/E9jkA.jpg" alt="http://i.stack.imgur.com/E9jkA.jpg"></p>
  
  <p>The legend label colors are not those assigned in the handles, nor are they a patch and a line with stars. I have tried removing and adding the lines, adding and removing the commas after the lines, etc. Are they any better references for using legend()? Any other tips for using proxy artists? I don't understand why the examples give me totally different results...</p>