Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove unnecessary explicit default loc='best' in legend()
  • Loading branch information
timhoffm committed May 9, 2018
commit e62a5ac198fe155de690dcbf340c4aa971c02b66
2 changes: 1 addition & 1 deletion examples/api/sankey_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
orientations=[-1, -1, -1], prior=0, connect=(0, 0))
diagrams = sankey.finish()
diagrams[-1].patch.set_hatch('/')
plt.legend(loc='best')
plt.legend()

###############################################################################
# Notice that only one connection is specified, but the systems form a
Expand Down
8 changes: 4 additions & 4 deletions examples/recipes/transparent_legends.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

ax.legend(loc='upper right')

Other times you don't know where your data is, and loc='best' will try
and place the legend::
Other times you don't know where your data is, and the default loc='best'
will try and place the legend::

ax.legend(loc='best')
ax.legend()

but still, your legend may overlap your data, and in these cases it's
nice to make the legend frame transparent.
Expand All @@ -27,7 +27,7 @@
ax.plot(np.random.rand(300), 's-', label='uniform distribution')
ax.set_ylim(-3, 3)

ax.legend(loc='best', fancybox=True, framealpha=0.5)
ax.legend(fancybox=True, framealpha=0.5)
ax.set_title('fancy, transparent legends')

plt.show()
2 changes: 1 addition & 1 deletion lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ def getname_val(identifier):
ax.set_xlabel('')

if not subplots:
ax.legend(ynamelist, loc='best')
ax.legend(ynamelist)

if xname=='date':
fig.autofmt_xdate()
Expand Down