SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: burak1000 <bur...@gm...> - 2015年04月21日 20:33:06
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.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /