@@ -219,7 +219,7 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
219
219
ax .set_frame_on (False )
220
220
ax .set_xticks ([])
221
221
ax .set_yticks ([])
222
- ax .set_facecolor ((1. , 0. , 0. , 0. ))
222
+ ax .set_facecolor ((1 , 0 , 0 , 0 ))
223
223
224
224
# for each axes, make a margin between the *pos* layoutbox and the
225
225
# *axes* layoutbox be a minimum size that can accomodate the
@@ -252,15 +252,15 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
252
252
# or width. This stops that... It *should* have been
253
253
# taken into account w/ pref_width...
254
254
if fig ._layoutbox .constrained_layout_called < 1 :
255
- ax ._poslayoutbox .constrain_height_min (20. , strength = 'weak' )
256
- ax ._poslayoutbox .constrain_width_min (20. , strength = 'weak' )
257
- ax ._layoutbox .constrain_height_min (20. , strength = 'weak' )
258
- ax ._layoutbox .constrain_width_min (20. , strength = 'weak' )
259
- ax ._poslayoutbox .constrain_top_margin (0. , strength = 'weak' )
260
- ax ._poslayoutbox .constrain_bottom_margin (0. ,
255
+ ax ._poslayoutbox .constrain_height_min (20 , strength = 'weak' )
256
+ ax ._poslayoutbox .constrain_width_min (20 , strength = 'weak' )
257
+ ax ._layoutbox .constrain_height_min (20 , strength = 'weak' )
258
+ ax ._layoutbox .constrain_width_min (20 , strength = 'weak' )
259
+ ax ._poslayoutbox .constrain_top_margin (0 , strength = 'weak' )
260
+ ax ._poslayoutbox .constrain_bottom_margin (0 ,
261
261
strength = 'weak' )
262
- ax ._poslayoutbox .constrain_right_margin (0. , strength = 'weak' )
263
- ax ._poslayoutbox .constrain_left_margin (0. , strength = 'weak' )
262
+ ax ._poslayoutbox .constrain_right_margin (0 , strength = 'weak' )
263
+ ax ._poslayoutbox .constrain_left_margin (0 , strength = 'weak' )
264
264
265
265
# do layout for suptitle.
266
266
if fig ._suptitle is not None :
@@ -285,8 +285,7 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
285
285
# parent gridspec. The ones that contain axes are not so constrained.
286
286
figlb = fig ._layoutbox
287
287
for child in figlb .children :
288
- name = (child .name ).split ('.' )[- 1 ][:- 3 ]
289
- if name == 'gridspec' :
288
+ if child ._is_gridspec_layoutbox ():
290
289
# farm the gridspec layout out.
291
290
#
292
291
# This routine makes all the subplot spec containers
@@ -437,8 +436,7 @@ def arange_subplotspecs(gs, hspace=0, wspace=0):
437
436
"""
438
437
sschildren = []
439
438
for child in gs .children :
440
- name = (child .name ).split ('.' )[- 1 ][:- 3 ]
441
- if name == 'ss' :
439
+ if child ._is_subplotspec_layoutbox ():
442
440
for child2 in child .children :
443
441
# check for gridspec children...
444
442
name = (child2 .name ).split ('.' )[- 1 ][:- 3 ]
@@ -513,10 +511,10 @@ def layoutcolorbarsingle(ax, cax, shrink, aspect, location, pad=0.05):
513
511
else :
514
512
layoutbox .hstack ([lb , axlb ], padding = pad * axlb .width )
515
513
# constrain the height and center...
516
- layoutbox .match_heights ([axpos , lbpos ], [1. , shrink ])
514
+ layoutbox .match_heights ([axpos , lbpos ], [1 , shrink ])
517
515
layoutbox .align ([axpos , lbpos ], 'v_center' )
518
516
# set the width of the pos box
519
- lbpos .constrain_width (shrink * axpos .height * (1. / aspect ),
517
+ lbpos .constrain_width (shrink * axpos .height * (1 / aspect ),
520
518
strength = 'strong' )
521
519
elif location in ('bottom' , 'top' ):
522
520
lbpos = layoutbox .LayoutBox (
@@ -533,7 +531,7 @@ def layoutcolorbarsingle(ax, cax, shrink, aspect, location, pad=0.05):
533
531
layoutbox .vstack ([lb , axlb ], padding = pad * axlb .height )
534
532
# constrain the height and center...
535
533
layoutbox .match_widths ([axpos , lbpos ],
536
- [1. , shrink ], strength = 'strong' )
534
+ [1 , shrink ], strength = 'strong' )
537
535
layoutbox .align ([axpos , lbpos ], 'h_center' )
538
536
# set the height of the pos box
539
537
lbpos .constrain_height (axpos .width * aspect * shrink ,
@@ -605,7 +603,7 @@ def layoutcolorbargridspec(parents, cax, shrink, aspect, location, pad=0.05):
605
603
shrink , strength = 'strong' )
606
604
lbpos .constrain_bottom (
607
605
(maxposlb .top - minposlb .bottom ) *
608
- (1. - shrink )/ 2. + minposlb .bottom ,
606
+ (1 - shrink )/ 2 + minposlb .bottom ,
609
607
strength = 'strong' )
610
608
611
609
# set the width of the pos box
@@ -647,7 +645,7 @@ def layoutcolorbargridspec(parents, cax, shrink, aspect, location, pad=0.05):
647
645
shrink )
648
646
lbpos .constrain_left (
649
647
(maxposlb .right - minposlb .left ) *
650
- (1. - shrink )/ 2. + minposlb .left )
648
+ (1 - shrink )/ 2 + minposlb .left )
651
649
# set the height of the pos box
652
650
lbpos .constrain_height (lbpos .width * shrink * aspect ,
653
651
strength = 'medium' )
0 commit comments