8000 Small cleanup · matplotlib/matplotlib@3dbd703 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3dbd703

Browse files
committed
Small cleanup
1 parent 3aa9fe9 commit 3dbd703

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
@@ -1840,13 +1840,10 @@ def legend(self, *args, outside=False, ax=None, **kwargs):
18401840
self.legends.append(l)
18411841
else:
18421842
loc = kwargs.pop('loc')
1843-
if ax is None:
1844-
gs = self.get_gridspecs()[0]
1843+
if isinstance(ax, GridSpecBase):
1844+
gs = ax
18451845
else:
1846-
if isinstance(ax, GridSpecBase):
1847-
gs = ax
1848-
else:
1849-
gs = ax[0].get_gridspec()
1846+
gs = ax[0].get_gridspec()
18501847
l = gs.legend_outside(loc=loc, align=outside, handles=handles,
18511848
labels=labels, **kwargs)
18521849
l._remove_method = self.legends.remove

lib/matplotlib/gridspec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ def legend_outside(self, handles=None, labels=None, axs=None,
181181
"""
182182
legend for this gridspec, offset from all the subplots.
183183
184-
See `.Figure.legend_outside` for details on how to call.
184+
See the *outside* argument for `.Figure.legend` for details on how to
185+
call.
185186
"""
186187
if not (self.figure and self.figure.get_constrained_layout()):
187188
cbook._warn_external('legend_outside method needs '

0 commit comments

Comments
 (0)
0