matplotlib._layoutgrid

A layoutgrid is a nrows by ncols set of boxes, meant to be used by ._constrained_layout, each box is analogous to a subplotspec element of a gridspec.

Each box is defined by left[ncols], right[ncols], bottom[nrows] and top[nrows], and by two editable margins for each side. The main margin gets its value set by the size of ticklabels, titles, etc on each axes that is in the figure. The outer margin is the padding around the axes, and space for any colorbars.

The “inner” widths and heights of these boxes are then constrained to be the same (relative the values of width_ratios[ncols] and height_ratios[nrows]).

The layoutgrid is then constrained to be contained within a parent layoutgrid, its column(s) and row(s) specified when it is created.