Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ae5c8e2

Browse filesBrowse 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
Copy full SHA for ae5c8e2

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+1-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.