8000 Fix NameError in example code for setting label via method · matplotlib/matplotlib@ae5c8e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit ae5c8e2

Browse files
authored
Fix NameError in example code for setting label via method
The example code currently raises a NameError as "line" is not defined until the 2nd line is run.
1 parent 666d3d0 commit ae5c8e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ def legend(self, *args, **kwargs):
321321
322322
or::
323323
324-
line.set_label('Label via method')
325324
line, = ax.plot([1, 2, 3])
325+
line.set_label('Label via method')
326326
ax.legend()
327327
328328
Specific lines can be excluded from the automatic legend element

0 commit comments

Comments
 (0)
0