mpl.pyplot.GridSpec

class mpl.pyplot.GridSpec(nrows, ncols, left=None, bottom=None, right=None, top=None, wspace=None, hspace=None, width_ratios=None, height_ratios=None)[source]

A class that specifies the geometry of the grid that a subplot will be placed. The location of grid is determined by similar way as the SubplotParams.

__init__(nrows, ncols, left=None, bottom=None, right=None, top=None, wspace=None, hspace=None, width_ratios=None, height_ratios=None)[source]

The number of rows and number of columns of the grid need to be set. Optionally, the subplot layout parameters (e.g., left, right, etc.) can be tuned.

Methods

__init__(nrows, ncols[, left, bottom, ...]) The number of rows and number of columns of the grid need to be set.
get_geometry() get the geometry of the grid, e.g., 2,3
get_grid_positions(fig) return lists of bottom and top position of rows, left and
get_height_ratios()
get_subplot_params([fig]) return a dictionary of subplot layout parameters. The default
get_width_ratios()
locally_modified_subplot_params()
new_subplotspec(loc[, rowspan, colspan]) create and return a SuplotSpec instance.
set_height_ratios(height_ratios)
set_width_ratios(width_ratios)
tight_layout(fig[, renderer, pad, h_pad, ...]) Adjust subplot parameters to give specified padding.
update(**kwargs) Update the current values.