8000 plot label will not show up on legend if _ is used as first charcter in label · Issue #5200 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
plot label will not show up on legend if _ is used as first charcter in label #5200
Closed
@PrometheusPi

Description

@PrometheusPi

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:

/opt/pkg/devel/python/3.4.3/lib/python3.4/site-packages/matplotlib-1.4.3-py3.4-linux-x86_64.egg/matplotlib/axes/_axes.py:475: UserWarning: No labelled objects found. Use label='...' kwarg on individual plots.
  warnings.warn("No labelled objects found. "

In order to test this bug, I tried a variety of matplotlib versions on Ubuntu and OS X.

  • 0.99.1.1
  • 1.1.0
  • 1.3.1
  • 1.4.3

All have the above behavior.

In order to reproduce the bug, I used the following minimal example:

import numpy as np
import matplotlib
import matplotlib.pyplot as plt

print(matplotlib.__version__)

x = np.linspace(-10, 10, 1024)
y = np.sin(x)

plt.plot(x,y, label="_abc")

plt.legend()
plt.show()

Using r"_abc" instead does not solve the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0