calamari.style.figure#

calamari.style.figure(spec, *, width='single', look=None, height_cm=None, nrows=1, ncols=1, **subplots_kwargs)#

Create a journal-sized figure and axes, styled, in one call.

plt.subplots under context(), returning what it returns. The figure keeps its size after the context ends, but artists added later from outside a style context take the session’s rcParams – so build the whole figure inside one context() block when mixing helpers with your own ax.plot calls, or call use() once.

The default height gives every panel DEFAULT_ASPECT, so a two-across double-column figure is one panel tall; layout='constrained' is on unless subplots_kwargs says otherwise, because tick labels at 7 pt on an 8.5 cm figure clip without it.

Parameters:
  • spec (str) – As for rc(). height_cm is the height of the whole figure.

  • width (str | float) – As for rc(). height_cm is the height of the whole figure.

  • look (str | None) – As for rc(). height_cm is the height of the whole figure.

  • height_cm (float | None) – As for rc(). height_cm is the height of the whole figure.

  • nrows (int) – Panel grid, forwarded to plt.subplots.

  • ncols (int) – Panel grid, forwarded to plt.subplots.

  • **subplots_kwargs (Any) – Forwarded to plt.subplots (sharex=, gridspec_kw=, …).

Return type:

tuple[Figure, Any]

Returns:

tuple – (fig, axes) exactly as plt.subplots returns them: a single Axes for a 1x1 grid, otherwise an array of them.