nested_grid_plotter.SubfigsBuilder#

class nested_grid_plotter.SubfigsBuilder(*, nrows: int = 1, ncols: int = 1, squeeze: bool = True, wspace: float | None = None, hspace: float | None = None, width_ratios: ArrayLike | None = None, height_ratios: ArrayLike | None = None, sub_builders: Dict[str, NestedBuilder] | None = None, **kwargs)[source]#

Bases: NestedBuilder

Args and kwargs for Figure.subfigures routine.

Added in version 2.0.

__init__(*, nrows: int = 1, ncols: int = 1, squeeze: bool = True, wspace: float | None = None, hspace: float | None = None, width_ratios: ArrayLike | None = None, height_ratios: ArrayLike | None = None, sub_builders: Dict[str, NestedBuilder] | None = None, **kwargs) None[source]#

Initiate the instance.

Parameters:
  • nrows (int, default: 1) – Number of rows/columns of the subfigure grid.

  • ncols (int, default: 1) – Number of rows/columns of the subfigure grid.

  • squeeze (bool, default: True) – If True, extra dimensions are squeezed out from the returned array of subfigures.

  • wspace (float, default: None) – The amount of width/height reserved for space between subfigures, expressed as a fraction of the average subfigure width/height. If not given, the values will be inferred from rcParams if using constrained layout (see ~.ConstrainedLayoutEngine), or zero if not using a layout engine.

  • hspace (float, default: None) – The amount of width/height reserved for space between subfigures, expressed as a fraction of the average subfigure width/height. If not given, the values will be inferred from rcParams if using constrained layout (see ~.ConstrainedLayoutEngine), or zero if not using a layout engine.

  • 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 row gets a relative height of height_ratios[i] / sum(height_ratios). If not given, all rows will have the same height.

Public methods summary

__call__(fig, figname, grouped_sf_dict, ...)

Call self as a function.

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__getstate__()

Helper for pickle.

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(*[, nrows, ncols, squeeze, wspace, ...])

Initiate the instance.

__init_subclass__()

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(*args, **kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__(object, /)

Abstract classes can override this to customize issubclass().

Methods definition

__call__(fig: Figure | SubFigure, figname: str, grouped_sf_dict: Dict[str, Dict[str, SubFigure]], grouped_ax_dict: Dict[str, Dict[str, Axes]]) None[source]#

Call self as a function.