GridSpec

class GridSpec(nrows=1, ncols=1, **kwargs)[source]

Bases: matplotlib.gridspec.GridSpec

A GridSpec subclass that permits variable spacing between successive rows and columns and hides “panel slots” from indexing.

Parameters
  • nrows, ncols (int, optional) – The number of rows and columns on the subplot grid.

  • left, right, top, bottom (float or str, optional) – The fixed space between the subplots and the figure edge. Default is None. %(units.em)s If None, the space is determined automatically based on the font size and axis sharing settings. If rc['subplots.tight'] is True, the space is determined by the tight layout algorithm.

  • wequal, hequal, equal (bool, optional) – Whether to make the tight layout algorithm apply equal spacing between columns, rows, or both. Default is False. Ignored if rc.tight is False.

  • outerpad (float or str, optional) – The tight layout padding around edge of figure. Units are interpreted by units. Default is rc['subplots.outerpad'] = 0.5. %(units.em)s

  • innerpad (float or str, optional) – The scalar tight layout padding between columns and rows. Synonymous with pad. Default is rc['subplots.innerpad'] = 1.0. %(units.em)s

  • panelpad (float or str, optional) – The tight layout padding between subplots and axes panels and between “stacked” panels. Default is rc['subplots.panelpad'] = 0.5. %(units.em)s

  • wequal, hequal, equal (bool, optional) – Whether to make the tight layout algorithm apply equal spacing between columns, rows, or both. Default is False. Ignored if rc.tight is False.

  • outerpad (float or str, optional) – The tight layout padding around edge of figure. Units are interpreted by units. Default is rc['subplots.outerpad'] = 0.5. %(units.em)s

  • innerpad (float or str, optional) – The scalar tight layout padding between columns and rows. Synonymous with pad. Default is rc['subplots.innerpad'] = 1.0. %(units.em)s

  • panelpad (float or str, optional) – The tight layout padding between subplots and axes panels and between “stacked” panels. Default is rc['subplots.panelpad'] = 0.5. %(units.em)s

Note

Adding axes panels, axes or figure colorbars, and axes or figure legends quietly augments the gridspec geometry by inserting “panel slots”. However subsequently indexing the gridspec with gs[num] or gs[row, col] will ignore the “panel slots”. This permits adding new subplots by passing gs[num] or gs[row, col] to add_subplot even in the presence of panels. See __getitem__ for details.

Attributes Summary

bottom

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

figure

The proplot.figure.Figure instance uniquely associated with this GridSpec.

hpad

hratios

hspace

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

left

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

ncols

The number of columns in the grid.

nrows

The number of rows in the grid.

right

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

top

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

wpad

wratios

wspace

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

Methods Summary

__getitem__(key)

Get a SubplotSpec.

get_geometry()

Return the total number of rows and columns in the grid.

get_grid_positions([figure])

Return the subplot grid positions allowing for variable inter-subplot spacing and using physical units for the spacing terms.

get_panel_geometry()

Return the number of rows and columns allocated for "panel" subplots and not available with gridspec[...] indexing.

get_subplot_geometry()

Return the number of rows and columns allocated for "main" subplots and available with gridspec[...] indexing.

update(**kwargs)

Update the gridspec with arbitrary initialization keyword arguments and update the subplot positions.