@@ -1175,6 +1175,7 @@ def _adjust_tight_layout(self, renderer, resize=True):
11751175 bottom = bbox .ymin
11761176 right = obox .xmax - bbox .xmax
11771177 top = obox .ymax - bbox .ymax
1178+
11781179 # Apply new bounds, permitting user overrides
11791180 # TODO: Account for bounding box NaNs?
11801181 for key , offset in zip (
@@ -1190,9 +1191,11 @@ def _adjust_tight_layout(self, renderer, resize=True):
11901191 panelpad = self ._panelpad
11911192 gridspec = self ._gridspec_main
11921193 nrows , ncols = gridspec .get_active_geometry ()
1193- wspace , hspace = subplots_kw ['wspace' ], subplots_kw ['hspace' ]
1194+ wspace = subplots_kw ['wspace' ]
1195+ hspace = subplots_kw ['hspace' ]
11941196 wspace_orig = subplots_orig_kw ['wspace' ]
11951197 hspace_orig = subplots_orig_kw ['hspace' ]
1198+
11961199 # Get new subplot spacings, axes panel spacing, figure panel spacing
11971200 spaces = []
11981201 for (w , x , y , nacross , ispace , ispace_orig ) in zip (
@@ -1256,7 +1259,6 @@ def _adjust_tight_layout(self, renderer, resize=True):
12561259 x2 = min (ax ._range_tightbbox (x )[0 ] for ax in group2 )
12571260 jspaces .append ((x2 - x1 ) / self .dpi )
12581261 if jspaces :
1259- # TODO: why max 0?
12601262 space = max (0 , space - min (jspaces ) + pad )
12611263 space = _notNone (space_orig , space ) # user input overwrite
12621264 jspace [i ] = space
@@ -1288,10 +1290,9 @@ def _align_axislabels(self, b=True):
12881290 if not isinstance (ax , axes .XYAxes ):
12891291 continue
12901292 for x , axis in zip ('xy' , (ax .xaxis , ax .yaxis )):
1291- # top or bottom, left or right
12921293 s = axis .get_label_position ()[0 ]
1293- span = getattr (ax , '_span' + x + '_on' )
1294- align = getattr (ax , '_align' + x + '_on' )
1294+ span = getattr (self , '_span' + x )
1295+ align = getattr (self , '_align' + x )
12951296 if s not in 'bl' or axis in tracker :
12961297 continue
12971298 axs = ax ._get_side_axes (s )
@@ -1336,8 +1337,9 @@ def _align_axislabels(self, b=True):
13361337 mtransforms .IdentityTransform (), self .transFigure )
13371338 for axis in axises :
13381339 axis .label .set_visible ((axis is spanaxis ))
1339- spanlabel .update (
1340- {'position' : position , 'transform' : transform })
1340+ spanlabel .update ({
1341+ 'position' : position , 'transform' : transform
1342+ })
13411343
13421344 def _align_labels (self , renderer ):
13431345 """Adjusts position of row and column labels, and aligns figure super
@@ -2046,11 +2048,7 @@ def subplots(
20462048 hspace = None , wspace = None , space = None ,
20472049 hratios = None , wratios = None ,
20482050 width_ratios = None , height_ratios = None ,
2049- flush = None , wflush = None , hflush = None ,
20502051 left = None , bottom = None , right = None , top = None ,
2051- span = None , spanx = None , spany = None ,
2052- align = None , alignx = None , aligny = None ,
2053- share = None , sharex = None , sharey = None ,
20542052 basemap = False , proj = None , projection = None ,
20552053 proj_kw = None , projection_kw = None ,
20562054 ** kwargs
0 commit comments