You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plot label will not show up on legend if _ is used as first charcter in label #5200
It seems to be the intended behavior as documented:
Specific lines can be excluded from the automatic legend element selection by
defining a label starting with an underscore. This is default for all artists, so
calling legend() without any arguments and without setting the labels manually
will result in no legend being drawn.
Sorry for the inconvenience. From my side, this issue can be closed.
Activity
PrometheusPi commentedon Oct 6, 2015
The reason for this behavior comes from this if clause.
It seems to be the intended behavior as documented:
Sorry for the inconvenience. From my side, this issue can be closed.
tacaswell commentedon Oct 6, 2015
It is a surprising 'feature', but it has been that way for a long time and changing it would likely break a lot of code in the wild.
jhollowed commentedon Aug 31, 2021
this just sent me on a wild goose chase. All of my labels started with
__, so I kept getting "No handles with labels found to put in legend."This was very cryptic, and I could not solve this issue until finding this page. The error messaging on this should be improved.
jklymak commentedon Aug 31, 2021
The docs are relatively explicit about this https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.legend.html. Is there somewhere else you'd expect this information? If so, a PR would be most welcome.