matplotlib.gridspec.GridSpecBase¶
-
class
matplotlib.gridspec.GridSpecBase(nrows, ncols, height_ratios=None, width_ratios=None)[source]¶ Bases:
objectA base class of GridSpec that specifies the geometry of the grid that a subplot will be placed.
Parameters: nrows, ncols : int
The number of rows and columns of the grid.
width_ratios : array-like of length ncols, optional
Defines the relative widths of the columns. Each column gets a relative width of
width_ratios[i] / sum(width_ratios). If not given, all columns will have the same width.height_ratios : array-like of length nrows, optional
Defines the relative heights of the rows. Each column gets a relative height of
height_ratios[i] / sum(height_ratios). If not given, all rows will have the same height.-
get_grid_positions(fig, raw=False)[source]¶ Return the positions of the grid cells in figure coordinates.
Parameters: fig :
FigureThe figure the grid should be applied to. The subplot parameters (margins and spacing between subplots) are taken from fig.
raw : bool, default: False
If True, the subplot parameters of the figure are not taken into account. The grid spans the range [0, 1] in both directions without margins and there is no space between grid cells. This is used for constrained_layout.
Returns: bottoms, tops, lefts, rights : array
The bottom, top, left, right positions of the grid cells in figure coordinates.
-
get_height_ratios()[source]¶ Return the height ratios.
This is None if no height ratios have been set explicitly.
-
get_width_ratios()[source]¶ Return the width ratios.
This is None if no width ratios have been set explicitly.
-
property
ncols¶ The number of columns in the grid.
-
new_subplotspec(loc, rowspan=1, colspan=1)[source]¶ Create and return a
SubplotSpecinstance.Parameters: loc : (int, int)
The position of the subplot in the grid as
(row_index, column_index).rowspan, colspan : int, default: 1
The number of rows and columns the subplot should span in the grid.
-
property
nrows¶ The number of rows in the grid.
-