Hi all, I believe I've found a bug in scatter function in matplotlib 1.4.2:
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() The code above fails with ValueError exception: Traceback (most recent call last): File "legend.py", line 9, in <module> 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 There is some more information and the source of the problem described here: http://stackoverflow.com/questions/29743696/legends-for-scatter-plots-with-nans-in-matplotlib Thanks, Tomasz -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Problem-creating-legend-for-scatter-plot-with-NANs-tp45419.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users