11"""
2- Adjust subplot layouts so that there are no overlapping axes or axes
3- decorations. All axes decorations are dealt with (labels, ticks, titles,
2+ Adjust subplot layouts so that there are no overlapping Axes or Axes
3+ decorations. All Axes decorations are dealt with (labels, ticks, titles,
44ticklabels) and some dependent artists are also dealt with (colorbar,
55suptitle).
66
77Layout is done via `~matplotlib.gridspec`, with one constraint per gridspec,
8- so it is possible to have overlapping axes if the gridspecs overlap (i.e.
8+ so it is possible to have overlapping Axes if the gridspecs overlap (i.e.
99using `~matplotlib.gridspec.GridSpecFromSubplotSpec`). Axes placed using
1010``figure.subplots()`` or ``figure.add_subplots()`` will participate in the
1111layout. Axes manually placed via ``figure.add_axes()`` will not.
3333is the width or height of each column/row minus the size of the margins.
3434
3535Then the size of the margins for each row and column are determined as the
36- max width of the decorators on each axes that has decorators in that margin.
37- For instance, a normal axes would have a left margin that includes the
36+ max width of the decorators on each Axes that has decorators in that margin.
37+ For instance, a normal Axes would have a left margin that includes the
3838left ticklabels, and the ylabel if it exists. The right margin may include a
3939colorbar, the bottom margin the xaxis decorations, and the top margin the
4040title.
@@ -73,11 +73,11 @@ def do_constrained_layout(fig, h_pad, w_pad,
7373 `.Figure` instance to do the layout in.
7474
7575 h_pad, w_pad : float
76- Padding around the axes elements in figure-normalized units.
76+ Padding around the Axes elements in figure-normalized units.
7777
7878 hspace, wspace : float
7979 Fraction of the figure to dedicate to space between the
80- axes . These are evenly spread between the gaps between the axes .
80+ Axes . These are evenly spread between the gaps between the Axes .
8181 A value of 0.2 for a three-column layout would have a space
8282 of 0.1 of the figure width between each column.
8383 If h/wspace < h/w_pad, then the pads are used instead.
@@ -111,7 +111,7 @@ def do_constrained_layout(fig, h_pad, w_pad,
111111 # larger/smaller). This second reposition tends to be much milder,
112112 # so doing twice makes things work OK.
113113
114- # make margins for all the axes and subfigures in the
114+ # make margins for all the Axes and subfigures in the
115115 # figure. Add margins for colorbars...
116116 make_layout_margins (layoutgrids , fig , renderer , h_pad = h_pad ,
117117 w_pad = w_pad , hspace = hspace , wspace = wspace )
@@ -128,7 +128,7 @@ def do_constrained_layout(fig, h_pad, w_pad,
128128
129129 warn_collapsed = ('constrained_layout not applied because '
130130 'axes sizes collapsed to zero. Try making '
131- 'figure larger or axes decorations smaller.' )
131+ 'figure larger or Axes decorations smaller.' )
132132 if check_no_collapsed_axes (layoutgrids , fig ):
133133 reposition_axes (layoutgrids , fig , renderer , h_pad = h_pad ,
134134 w_pad = w_pad , hspace = hspace , wspace = wspace )
@@ -152,7 +152,7 @@ def make_layoutgrids(fig, layoutgrids, rect=(0, 0, 1, 1)):
152152
153153 (Sub)Figures get a layoutgrid so we can have figure margins.
154154
155- Gridspecs that are attached to axes get a layoutgrid so axes
155+ Gridspecs that are attached to Axes get a layoutgrid so Axes
156156 can have margins.
157157 """
158158
@@ -182,7 +182,7 @@ def make_layoutgrids(fig, layoutgrids, rect=(0, 0, 1, 1)):
182182 for sfig in fig .subfigs :
183183 layoutgrids = make_layoutgrids (sfig , layoutgrids )
184184
185- # for each axes at the local level add its gridspec:
185+ # for each Axes at the local level add its gridspec:
186186 for ax in fig ._localaxes :
187187 gs = ax .get_gridspec ()
188188 if gs is not None :
@@ -239,7 +239,7 @@ def make_layoutgrids_gs(layoutgrids, gs):
239239
240240def check_no_collapsed_axes (layoutgrids , fig ):
241241 """
242- Check that no axes have collapsed to zero size.
242+ Check that no Axes have collapsed to zero size.
243243 """
244244 for sfig in fig .subfigs :
245245 ok = check_no_collapsed_axes (layoutgrids , sfig )
@@ -270,7 +270,7 @@ def compress_fixed_aspect(layoutgrids, fig):
270270 extraw = np .zeros (gs .ncols )
271271 extrah = np .zeros (gs .nrows )
272272 elif _gs != gs :
273- raise ValueError ('Cannot do compressed layout if axes are not'
273+ raise ValueError ('Cannot do compressed layout if Axes are not'
274274 'all from the same gridspec' )
275275 orig = ax .get_position (original = True )
276276 actual = ax .get_position (original = False )
@@ -282,7 +282,7 @@ def compress_fixed_aspect(layoutgrids, fig):
282282 extrah [sub .rowspan ] = np .maximum (extrah [sub .rowspan ], dh )
283283
284284 if gs is None :
285- raise ValueError ('Cannot do compressed layout if no axes '
285+ raise ValueError ('Cannot do compressed layout if no Axes '
286286 'are part of a gridspec.' )
287287 w = np .sum (extraw ) / 2
288288 layoutgrids [fig ].edit_margin_min ('left' , w )
@@ -313,7 +313,7 @@ def get_margin_from_padding(obj, *, w_pad=0, h_pad=0,
313313 nrows , ncols = gs .get_geometry ()
314314 # there are two margins for each direction. The "cb"
315315 # margins are for pads and colorbars, the non-"cb" are
316- # for the axes decorations (labels etc).
316+ # for the Axes decorations (labels etc).
317317 margin = {'leftcb' : w_pad , 'rightcb' : w_pad ,
318318 'bottomcb' : h_pad , 'topcb' : h_pad ,
319319 'left' : 0 , 'right' : 0 ,
@@ -335,7 +335,7 @@ def get_margin_from_padding(obj, *, w_pad=0, h_pad=0,
335335def make_layout_margins (layoutgrids , fig , renderer , * , w_pad = 0 , h_pad = 0 ,
336336 hspace = 0 , wspace = 0 ):
337337 """
338- For each axes , make a margin between the *pos* layoutbox and the
338+ For each Axes , make a margin between the *pos* layoutbox and the
339339 *axes* layoutbox be a minimum size that can accommodate the
340340 decorations on the axis.
341341
@@ -379,7 +379,7 @@ def make_layout_margins(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0,
379379 margin = get_margin_from_padding (ax , w_pad = w_pad , h_pad = h_pad ,
380380 hspace = hspace , wspace = wspace )
381381 pos , bbox = get_pos_and_bbox (ax , renderer )
382- # the margin is the distance between the bounding box of the axes
382+ # the margin is the distance between the bounding box of the Axes
383383 # and its position (plus the padding from above)
384384 margin ['left' ] += pos .x0 - bbox .x0
385385 margin ['right' ] += bbox .x1 - pos .x1
@@ -388,7 +388,7 @@ def make_layout_margins(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0,
388388 margin ['top' ] += bbox .y1 - pos .y1
389389
390390 # make margin for colorbars. These margins go in the
391- # padding margin, versus the margin for axes decorators.
391+ # padding margin, versus the margin for Axes decorators.
392392 for cbax in ax ._colorbars :
393393 # note pad is a fraction of the parent width...
394394 pad = colorbar_get_pad (layoutgrids , cbax )
@@ -493,14 +493,14 @@ def match_submerged_margins(layoutgrids, fig):
493493 """
494494 Make the margins that are submerged inside an Axes the same size.
495495
496- This allows axes that span two columns (or rows) that are offset
496+ This allows Axes that span two columns (or rows) that are offset
497497 from one another to have the same size.
498498
499499 This gives the proper layout for something like::
500500 fig = plt.figure(constrained_layout=True)
501501 axs = fig.subplot_mosaic("AAAB\n CCDD")
502502
503- Without this routine, the axes D will be wider than C, because the
503+ Without this routine, the Axes D will be wider than C, because the
504504 margin width between the two columns in C has no width by default,
505505 whereas the margins between the two columns of D are set by the
506506 width of the margin between A and B. However, obviously the user would
@@ -613,7 +613,7 @@ def get_cb_parent_spans(cbax):
613613
614614def get_pos_and_bbox (ax , renderer ):
615615 """
616- Get the position and the bbox for the axes .
616+ Get the position and the bbox for the Axes .
617617
618618 Parameters
619619 ----------
@@ -642,7 +642,7 @@ def get_pos_and_bbox(ax, renderer):
642642def reposition_axes (layoutgrids , fig , renderer , * ,
643643 w_pad = 0 , h_pad = 0 , hspace = 0 , wspace = 0 ):
644644 """
645- Reposition all the axes based on the new inner bounding box.
645+ Reposition all the Axes based on the new inner bounding box.
646646 """
647647 trans_fig_to_subfig = fig .transFigure - fig .transSubfigure
648648 for sfig in fig .subfigs :
0 commit comments