diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ceacd014ef7a..5b1a3d39f493 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -321,8 +321,8 @@ def legend(self, *args, **kwargs): or:: - line.set_label('Label via method') line, = ax.plot([1, 2, 3]) + line.set_label('Label via method') ax.legend() Specific lines can be excluded from the automatic legend element