syncopy.plotting.spy_plotting._setup_figure

syncopy.plotting.spy_plotting._setup_figure(npanels, nrow=None, ncol=None, xLabel=None, yLabel=None, include_colorbar=False, sharex=None, sharey=None, grid=None)[source]

Create and set up a Figure object for Syncopy visualizations

Parameters
  • npanels (int or None) – Subplot-panel parameters. Please refer to _layout_subplot_panels() for details.

  • nrow (int or None) – Subplot-panel parameters. Please refer to _layout_subplot_panels() for details.

  • ncol (int or None) – Subplot-panel parameters. Please refer to _layout_subplot_panels() for details.

  • xLabel (str or None) – If not None, x-axis caption.

  • yLabel (str or None) – If not None, y-axis caption.

  • include_colorbar (bool) – If True, axis panel(s) are set up to leave enough space for a colorbar

  • sharex (bool or None) – If True, axis panels have common x-axis ticks and limits. If None or False, x-ticks and -limits are not shared across axis panels.

  • sharey (bool or None) – If True, axis panels have common y-axis ticks and limits. If None or False, y-ticks and -limits are not shared across axis panels.

  • grid (bool or None) – If True, axis panels are set up to include grid-lines, if None or False no grid-lines will be rendered.

Returns

  • fig (Figure object) – Matplotlib figure formatted for Syncopy plotting routines

  • ax ((list of) Axis instance(s)) – Either single Axis object (if npanels = 1) or list of multiple Axis objects (if npanels > 1)

  • cax (None or Axis) – If include_colorbar is True, all axis panels are laid out to leave space for an additional axis cax reserved for a colorbar.

Notes

If npanels is greater than one, the local helper function _layout_subplot_panels() is invoked to create a space-optimal panel grid (adjusted for an additional axis reserved for a colorbar, if include_colorbar is True).

To ease internal processing, this routine attaches a number of additional attributes to the generated Figure object fig, namely:

  • fig.singlepanelplot (bool): if npanels = 1 the caller was singlepanelplot() and the identically named attribute is created

  • fig.multipanelplot (bool): conversely, if npanels > 1 the caller was multipanelplot() and the identically named attribute is created

  • fig.objCount (int): internal counter used for overlay-plotting. Initially, fig.objCount is set to 0, every overly increments fig.objCount by one

  • fig.npanels (int): number of panels as given by the input argument npanels

Note that this is an auxiliary method that is intended purely for internal use. Please refer to the user-exposed methods singlepanelplot() and/or multipanelplot() to actually generate plots of Syncopy data objects.

See also

_layout_subplot_panels()

Create space-optimal subplot grid for Syncopy visualizations

_setup_colorbar()

format colorbar for Syncopy visualizations