syncopy.plotting.spy_plotting._layout_subplot_panels¶
-
syncopy.plotting.spy_plotting.
_layout_subplot_panels
(npanels, nrow=None, ncol=None, ndefault=5, maxpanels=50)[source]¶ Create space-optimal subplot grid given required number of panels
- Parameters
npanels (int) – Number of required subplot panels in figure
nrow (int or None) – Required number of panel rows. Note, if both nrow and ncol are not None, then
nrow * ncol >= npanels
has to be satisfied, otherwise aSPYValueError
is raised.ncol (int or None) – Required number of panel columns. Note, if both nrow and ncol are not None, then
nrow * ncol >= npanels
has to be satisfied, otherwise aSPYValueError
is raised.ndefault (int) – Default number of panel columns for grid construction (only relevant if both nrow and ncol are None).
maxpanels (int) – Maximally allowed number of subplot panels for which a grid is constructed
- Returns
nrow (int) – Number of rows of constructed subplot panel grid
nrow (int) – Number of columns of constructed subplot panel grid
Notes
If both nrow and ncol are None, the constructed grid will have the dimension N x ndefault, where N is chosen “optimally”, i.e., the smallest integer that satisfies
ndefault * N >= npanels
. Note further, that this is an auxiliary method that is intended purely for internal use. Thus, error-checking is only performed on potentially user-provided inputs (nrow and ncol).See also
_setup_figure()
create and prepare figures for Syncopy visualizations
Examples
Create grid of default dimensions to hold eight panels
>>> _layout_subplot_panels(8, ndefault=5) (2, 5)
Create a grid that must have 4 rows
>>> _layout_subplot_panels(8, nrow=4) (4, 2)
Create a grid that must have 8 columns
>>> _layout_subplot_panels(8, ncol=8) (1, 8)