I have the following code in python :
import matplotlib.pyplot as plt plt.plot([1,2,3],label="_test") plt.legend() plt.show()
And when running it, the following warning appears :
/usr/lib/pymodules/python2.7/matplotlib/axes.py:4486: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots.
warnings.warn("No labeled objects found. "
and no legend shows up.
It appears, after trying to remove the '_' at the beginning of the label that the problem comes from here.
Does anybody know why it is so ? Is it a known voluntary/logical feature, an inconvenience or a bug ? Is it reported anywhere, since i couldn't find anything about this on http://matplotlib.org/users/legend_guide.html ? Is it specific to the label of the legend or it occurs as well with some other labels (title, xylabels maybe ?)
Thank you very much for your help
It is documented in the documentation for
legend, which is linked from the page you linked to:
Specific lines can be excluded from the automatic legend element selection by defining a label starting with an underscore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With