@@ -219,7 +219,7 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
219219 ax .set_frame_on (False )
220220 ax .set_xticks ([])
221221 ax .set_yticks ([])
222- ax .set_facecolor ((1. , 0. , 0. , 0. ))
222+ ax .set_facecolor ((1 , 0 , 0 , 0 ))
223223
224224 # for each axes, make a margin between the *pos* layoutbox and the
225225 # *axes* layoutbox be a minimum size that can accomodate the
@@ -252,15 +252,15 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
252252 # or width. This stops that... It *should* have been
253253 # taken into account w/ pref_width...
254254 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 ,
261261 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' )
264264
265265 # do layout for suptitle.
266266 if fig ._suptitle is not None :
@@ -285,8 +285,7 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,
285285 # parent gridspec. The ones that contain axes are not so constrained.
286286 figlb = fig ._layoutbox
287287 for child in figlb .children :
288- name = (child .name ).split ('.' )[- 1 ][:- 3 ]
289- if name == 'gridspec' :
288+ if child ._is_gridspec_layoutbox ():
290289 # farm the gridspec layout out.
291290 #
292291 # This routine makes all the subplot spec containers
@@ -437,8 +436,7 @@ def arange_subplotspecs(gs, hspace=0, wspace=0):
437436 """
438437 sschildren = []
439438 for child in gs .children :
440- name = (child .name ).split ('.' )[- 1 ][:- 3 ]
441- if name == 'ss' :
439+ if child ._is_subplotspec_layoutbox ():
442440 for child2 in child .children :
443441 # check for gridspec children...
444442 name = (child2 .name ).split ('.' )[- 1 ][:- 3 ]
@@ -513,10 +511,10 @@ def layoutcolorbarsingle(ax, cax, shrink, aspect, location, pad=0.05):
513511 else :
514512 layoutbox .hstack ([lb , axlb ], padding = pad * axlb .width )
515513 # constrain the height and center...
516- layoutbox .match_heights ([axpos , lbpos ], [1. , shrink ])
514+ layoutbox .match_heights ([axpos , lbpos ], [1 , shrink ])
517515 layoutbox .align ([axpos , lbpos ], 'v_center' )
518516 # 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 ),
520518 strength = 'strong' )
521519 elif location in ('bottom' , 'top' ):
522520 lbpos = layoutbox .LayoutBox (
@@ -533,7 +531,7 @@ def layoutcolorbarsingle(ax, cax, shrink, aspect, location, pad=0.05):
533531 layoutbox .vstack ([lb , axlb ], padding = pad * axlb .height )
534532 # constrain the height and center...
535533 layoutbox .match_widths ([axpos , lbpos ],
536- [1. , shrink ], strength = 'strong' )
534+ [1 , shrink ], strength = 'strong' )
537535 layoutbox .align ([axpos , lbpos ], 'h_center' )
538536 # set the height of the pos box
539537 lbpos .constrain_height (axpos .width * aspect * shrink ,
@@ -605,7 +603,7 @@ def layoutcolorbargridspec(parents, cax, shrink, aspect, location, pad=0.05):
605603 shrink , strength = 'strong' )
606604 lbpos .constrain_bottom (
607605 (maxposlb .top - minposlb .bottom ) *
608- (1. - shrink )/ 2. + minposlb .bottom ,
606+ (1 - shrink )/ 2 + minposlb .bottom ,
609607 strength = 'strong' )
610608
611609 # set the width of the pos box
@@ -647,7 +645,7 @@ def layoutcolorbargridspec(parents, cax, shrink, aspect, location, pad=0.05):
647645 shrink )
648646 lbpos .constrain_left (
649647 (maxposlb .right - minposlb .left ) *
650- (1. - shrink )/ 2. + minposlb .left )
648+ (1 - shrink )/ 2 + minposlb .left )
651649 # set the height of the pos box
652650 lbpos .constrain_height (lbpos .width * shrink * aspect ,
653651 strength = 'medium' )
0 commit comments