Skip to content

Commit 3d64d65

Browse files
committed
FIX/ENH Constrained Layout: Make whether single parent colorbar w/ gridspec or subplotspec
1 parent 3f3065d commit 3d64d65

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/colorbar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
11241124
anchor = kw.pop('anchor', loc_settings['anchor'])
11251125
parent_anchor = kw.pop('panchor', loc_settings['panchor'])
11261126

1127+
parents_iterable = cbook.iterable(parents)
11271128
# turn parents into a list if it is not already. We do this w/ np
11281129
# because `plt.subplots` can return an ndarray and is natural to
11291130
# pass to `colorbar`.
@@ -1191,7 +1192,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
11911192
# and we need to set the aspect ratio by hand...
11921193
cax.set_aspect(aspect, anchor=anchor, adjustable='box')
11931194
else:
1194-
if len(parents) == 1:
1195+
if not parents_iterable:
11951196
# this is a single axis...
11961197
ax = parents[0]
11971198
lb, lbpos = constrained_layout.layoutcolorbarsingle(

0 commit comments

Comments
 (0)