title: Legends for scatter plots with NANs in matplotlib
body: <p>I am having problems creating legends for scatter plots with NAN values.</p>
  
  <pre><code>from numpy import *
  import matplotlib
  from matplotlib.pyplot import *
  
  figure()
  subplot(111)
  h = scatter([NAN], [NAN], marker="o", facecolor="r", edgecolor="r", s=3)
  
  legend([h], ["scatter"])
  
  savefig("out.png")
  
  close()
  </code></pre>
  
  <p>The code above fails with <code>ValueError</code> exception:</p>
  
  <pre><code>Traceback (most recent call last):
    File "legend.py", line 9, in &lt;module&gt;
      legend([h], ["scatter"])
    File "/usr/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 3381, in legend
      ret = gca().legend(*args, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/axes.py", line 4778, in legend
      self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
    File "/usr/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/legend.py", line 366, in __init__
      self._init_legend_box(handles, labels)
    File "/usr/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/legend.py", line 630, in _init_legend_box
      handlebox)
    File "/usr/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/legend_handler.py", line 103, in __call__
      handlebox.get_transform())
    File "/usr/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/legend_handler.py", line 325, in create_artists
      width, height, fontsize)
    File "/usr/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/legend_handler.py", line 282, in get_sizes
      size_max = max(orig_handle.get_sizes()) * legend.markerscale ** 2
  ValueError: max() arg is an empty sequence
  </code></pre>
  
  <p>What is strange is that the exception is thrown only if I pass a one-element NAN list to <code>scatter()</code>. The result is as expected with empty lists and longer than 1 lists of NANs. The result is the same if I use numpy arrays instead of lists. Is there an explanation to this?</p>
  
  <p>I am using <code>matplotlib</code> version <code>1.3.1</code>. </p>