Skip to content

Commit 32a1a8a

Browse files
committed
Small cleanup
1 parent 9601279 commit 32a1a8a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

lib/matplotlib/figure.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,13 +1787,10 @@ def legend(self, *args, outside=False, ax=None, **kwargs):
17871787
self.legends.append(l)
17881788
else:
17891789
loc = kwargs.pop('loc')
1790-
if ax is None:
1791-
gs = self.get_gridspecs()[0]
1790+
if isinstance(ax, GridSpecBase):
1791+
gs = ax
17921792
else:
1793-
if isinstance(ax, GridSpecBase):
1794-
gs = ax
1795-
else:
1796-
gs = ax[0].get_gridspec()
1793+
gs = ax[0].get_gridspec()
17971794
l = gs.legend_outside(loc=loc, align=outside, handles=handles,
17981795
labels=labels, **kwargs)
17991796
l._remove_method = self.legends.remove

lib/matplotlib/gridspec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ def legend_outside(self, handles=None, labels=None, axs=None,
177177
"""
178178
legend for this gridspec, offset from all the subplots.
179179
180-
See `.Figure.legend_outside` for details on how to call.
180+
See the *outside* argument for `.Figure.legend` for details on how to
181+
call.
181182
"""
182183
if not (self.figure and self.figure.get_constrained_layout()):
183184
cbook._warn_external('legend_outside method needs '

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy