anyplotlib.GridSpec#

class anyplotlib.GridSpec(nrows, ncols, *, width_ratios=None, height_ratios=None)[source]#

Bases: object

Define a grid of subplot cells.

Parameters:
  • nrows (int) – Grid dimensions.

  • ncols (int) – Grid dimensions.

  • width_ratios (list of float, optional) – Relative column widths (length ncols). Defaults to equal widths.

  • height_ratios (list of float, optional) – Relative row heights (length nrows). Defaults to equal heights.

Examples

>>> gs = GridSpec(2, 3, width_ratios=[2, 1, 1])
>>> spec = gs[0, :]          # top row spanning all columns
>>> spec = gs[1, 1:3]        # bottom-right 2 columns