WrightTools.artists.GridSpec

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

GridSpec.

__init__(nrows, ncols, figure=None, left=None, bottom=None, right=None, top=None, wspace=None, hspace=None, width_ratios=None, height_ratios=None)[source]
Parameters
  • nrows (int) – The number of rows and columns of the grid.

  • ncols (int) – The number of rows and columns of the grid.

  • figure (~.figure.Figure, optional) – Only used for constrained layout to create a proper layoutbox.

  • left (float, optional) – Extent of the subplots as a fraction of figure width or height. Left cannot be larger than right, and bottom cannot be larger than top. If not given, the values will be inferred from a figure or rcParams at draw time. See also GridSpec.get_subplot_params.

  • right (float, optional) – Extent of the subplots as a fraction of figure width or height. Left cannot be larger than right, and bottom cannot be larger than top. If not given, the values will be inferred from a figure or rcParams at draw time. See also GridSpec.get_subplot_params.

  • top (float, optional) – Extent of the subplots as a fraction of figure width or height. Left cannot be larger than right, and bottom cannot be larger than top. If not given, the values will be inferred from a figure or rcParams at draw time. See also GridSpec.get_subplot_params.

  • bottom (float, optional) – Extent of the subplots as a fraction of figure width or height. Left cannot be larger than right, and bottom cannot be larger than top. If not given, the values will be inferred from a figure or rcParams at draw time. See also GridSpec.get_subplot_params.

  • wspace (float, optional) – The amount of width reserved for space between subplots, expressed as a fraction of the average axis width. If not given, the values will be inferred from a figure or rcParams when necessary. See also GridSpec.get_subplot_params.

  • hspace (float, optional) – The amount of height reserved for space between subplots, expressed as a fraction of the average axis height. If not given, the values will be inferred from a figure or rcParams when necessary. See also GridSpec.get_subplot_params.

  • 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.

Methods

__init__(nrows, ncols[, figure, left, …])

param nrows

The number of rows and columns of the grid.

get_geometry()

Return a tuple containing the number of rows and columns in the grid.

get_grid_positions(fig[, raw])

Return the positions of the grid cells in figure coordinates.

get_height_ratios()

Return the height ratios.

get_subplot_params([figure])

Return the ~.SubplotParams for the GridSpec.

get_width_ratios()

Return the width ratios.

locally_modified_subplot_params()

Return a list of the names of the subplot parameters explicitly set in the GridSpec.

new_subplotspec(loc[, rowspan, colspan])

Create and return a .SubplotSpec instance.

set_height_ratios(height_ratios)

Set the relative heights of the rows.

set_width_ratios(width_ratios)

Set the relative widths of the columns.

subplots(*[, sharex, sharey, squeeze, …])

Add all subplots specified by this GridSpec to its parent figure.

tight_layout(figure[, renderer, pad, h_pad, …])

Adjust subplot parameters to give specified padding.

update(**kwargs)

Update the subplot parameters of the grid.

Attributes

ncols

The number of columns in the grid.

nrows

The number of rows in the grid.