title: Legend format lost after using: ax.legend(handles, labels )
body: <p>I have the same problem as in this post: Where the user wants to delete repeated entries in the legend: </p>
  
  <p><a href="https://stackoverflow.com/questions/13588920/stop-matplotlib-repeating-labels-in-legend">Stop matplotlib repeating labels in legend</a></p>
  
  <p>The answer works for me as well, however, when I use it, the legend format is completely lost. This happens when I apply the ax.legend(handles, labels) method. The following code (copied from <a href="http://matplotlib.org/examples/pylab_examples/legend_demo.html" rel="nofollow noreferrer">http://matplotlib.org/examples/pylab_examples/legend_demo.html</a>) illustrates this issue:</p>
  
  <pre><code># Example data
  a = np.arange(0,3, .02)
  b = np.arange(0,3, .02)
  c = np.exp(a)
  d = c[::-1]
  
  # Create plots with pre-defined labels.
  # Alternatively, you can pass labels explicitly when calling `legend`.
  fig, ax = plt.subplots()
  ax.plot(a, c, 'k--', label='Model length')
  ax.plot(a, d, 'k:', label='Data length')
  ax.plot(a, c+d, 'k', label='Total message length')
  
  # Now add the legend with some customizations.
  legend = ax.legend(loc='upper center', shadow=True)
  
  handles, labels = ax.get_legend_handles_labels()
  ax.legend(handles, labels )   
  
  # The frame is matplotlib.patches.Rectangle instance surrounding the legend.
  frame = legend.get_frame()
  frame.set_facecolor('0.90')
  
  # Set the fontsize
  for label in legend.get_texts():
      label.set_fontsize('large')
  
  for label in legend.get_lines():
      label.set_linewidth(1.5)  # the legend line width
  plt.show()
  </code></pre>
  
  <p>Result without using 'ax.legend(handles, labels)':
  <img src="https://i.stack.imgur.com/nSeOx.png" alt="enter image description here"></p>
  
  <p>Resul using 'ax.legend(handles, labels)':
  <img src="https://i.stack.imgur.com/Wp1hc.png" alt="enter image description here"></p>
  
  <p>Any advice would be most welcomed</p>
  
  <p>EDIT 1: Typo 'without' corrected</p>