Skip to content

Commit ca184e9

Browse files
committed
FIX
1 parent 4a4391b commit ca184e9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/matplotlib/gridspec.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,15 @@ def _check_gridspec_exists(figure, nrows, ncols):
205205
"""
206206
gs = None
207207
for ax in figure.get_axes():
208-
if hasattr(ax, 'get_subplotspec'):
209-
ggs = ax.get_subplotspec().get_gridspec()
210-
if hasattr(ggs, 'get_topmost_subplotspec'):
208+
if hasattr(ax, 'get_subplotspec'):
209+
ggs = ax.get_subplotspec().get_gridspec()
210+
if hasattr(ggs, 'get_topmost_subplotspec'):
211211
# This is needed for colorbar gridspec layouts.
212212
# This is probably OK becase this whole logic tree
213213
# is for when the user is doing simple things with the
214214
# add_subplot command. Complicated stuff, the proper
215215
# gridspec is passed in...
216216
ggs = ggs.get_topmost_subplotspec().get_gridspec()
217-
218217
(nrow, ncol) = ggs.get_geometry()
219218
if nrow == nrows and ncol == ncols:
220219
gs = ggs
@@ -586,7 +585,7 @@ def _from_subplot_args(figure, args):
586585
f"{len(args)} were given")
587586

588587
gs = GridSpec._check_gridspec_exists(figure, rows, cols)
589-
588+
590589
return gs[ii-1:jj]
591590

592591

0 commit comments

Comments
 (0)