You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Applications are open for the 2018 John Hunter Matplotlib Summer Fellowship. Apply now!
Version 2.2.2.post1695+gedd053d16
Fork me on GitHub


class matplotlib.gridspec.GridSpecBase(nrows, ncols, height_ratios=None, width_ratios=None)[source]

A base class of GridSpec that specifies the geometry of the grid that a subplot will be placed.

The number of rows and number of columns of the grid need to be set. Optionally, the ratio of heights and widths of rows and columns can be specified.


get the geometry of the grid, e.g., 2,3

get_grid_positions(fig, raw=False)[source]

return lists of bottom and top position of rows, left and right positions of columns.

If raw=True, then these are all in units relative to the container with no margins. (used for constrained_layout).

get_subplot_params(figure=None, fig=None)[source]
new_subplotspec(loc, rowspan=1, colspan=1)[source]

create and return a SuplotSpec instance.