Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b76aeaa

Browse files
committed
FIX: colorbar check for constrained layout
1 parent 72770e6 commit b76aeaa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/colorbar.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,8 +1132,12 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15,
11321132
parents = np.atleast_1d(parents).ravel()
11331133

11341134
# check if using constrained_layout:
1135-
gs = parents[0].get_subplotspec().get_gridspec()
1136-
using_constrained_layout = (gs._layoutbox is not None)
1135+
try:
1136+
gs = parents[0].get_subplotspec().get_gridspec()
1137+
using_constrained_layout = (gs._layoutbox is not None)
1138+
except AttributeError:
1139+
using_constrained_layout = False
1140+
11371141
# defaults are not appropriate for constrained_layout:
11381142
pad0 = loc_settings['pad']
11391143
if using_constrained_layout:

0 commit comments

Comments
 (0)