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 e62a5ac

Browse filesBrowse files
committed
Remove unnecessary explicit default loc='best' in legend()
1 parent c6ce3f6 commit e62a5ac
Copy full SHA for e62a5ac

File tree

Expand file treeCollapse file tree

3 files changed

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

3 files changed

+6
-6
lines changed

‎examples/api/sankey_basics.py

Copy file name to clipboardExpand all lines: examples/api/sankey_basics.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
orientations=[-1, -1, -1], prior=0, connect=(0, 0))
9292
diagrams = sankey.finish()
9393
diagrams[-1].patch.set_hatch('/')
94-
plt.legend(loc='best')
94+
plt.legend()
9595

9696
###############################################################################
9797
# Notice that only one connection is specified, but the systems form a

‎examples/recipes/transparent_legends.py

Copy file name to clipboardExpand all lines: examples/recipes/transparent_legends.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
1010
ax.legend(loc='upper right')
1111
12-
Other times you don't know where your data is, and loc='best' will try
13-
and place the legend::
12+
Other times you don't know where your data is, and the default loc='best'
13+
will try and place the legend::
1414
15-
ax.legend(loc='best')
15+
ax.legend()
1616
1717
but still, your legend may overlap your data, and in these cases it's
1818
nice to make the legend frame transparent.
@@ -27,7 +27,7 @@
2727
ax.plot(np.random.rand(300), 's-', label='uniform distribution')
2828
ax.set_ylim(-3, 3)
2929

30-
ax.legend(loc='best', fancybox=True, framealpha=0.5)
30+
ax.legend(fancybox=True, framealpha=0.5)
3131
ax.set_title('fancy, transparent legends')
3232

3333
plt.show()

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2192,7 +2192,7 @@ def getname_val(identifier):
21922192
ax.set_xlabel('')
21932193

21942194
if not subplots:
2195-
ax.legend(ynamelist, loc='best')
2195+
ax.legend(ynamelist)
21962196

21972197
if xname=='date':
21982198
fig.autofmt_xdate()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.