New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plot label will not show up on legend if _ is used as first charcter in label #5200
Comments
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. |
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. |
this just sent me on a wild goose chase. All of my labels started with This was very cryptic, and I could not solve this issue until finding this page. The error messaging on this should be improved. |
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. |
If the ASCII character 95
_
is used in as first character in a plot label, the label will not show up in the legend.If only labels with
_
in front are used, the following warning is given:In order to test this bug, I tried a variety of matplotlib versions on Ubuntu and OS X.
All have the above behavior.
In order to reproduce the bug, I used the following minimal example:
Using
r"_abc"
instead does not solve the problem.The text was updated successfully, but these errors were encountered: