StyleSpec

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class StyleSpec(name: str, single_column_mm: float = 89.0, double_column_mm: float = 183.0, dpi: int = 300, font_family: str = 'sans-serif', font_size: float = 8.0, line_width: float = 1.0, palette: ~typing.Tuple[str, ...] = ('#0072B2', '#D55E00', '#009E73', '#CC79A7', '#E69F00', '#56B4E9', '#F0E442', '#000000'), extra_rcparams: ~typing.Dict[str, object] = <factory>)[source]

Bases: object

A named bundle of figure-geometry and typography choices.

name

Preset identifier used with use_style().

Type:

str

single_column_mm

Width of a single-column (or minimum submission) figure in millimetres.

Type:

float

double_column_mm

Width of a full-width figure in millimetres.

Type:

float

dpi

Default savefig.dpi hint for raster export. Callers may override at savefig time (e.g. RSNA line art at 1200 dpi).

Type:

int

font_family

"sans-serif" or "serif".

Type:

str

font_size

Base font size in points; tick/legend sizes scale from it.

Type:

float

line_width

Base line width in points.

Type:

float

palette

Colour cycle for groups/models.

Type:

Tuple[str, …]

extra_rcparams

Any further rcParams the preset overrides.

Type:

Dict[str, object]

rcparams() → Dict[str, object][source]

Translate the spec into a matplotlib rcParams mapping.

figsize(*, columns: int = 1, height_mm: float | None = None) → Tuple[float, float][source]

Return an inch figure size for a one- or two-column figure.

Parameters:
  • columns – 1 for a single-column-width figure, 2 for full text width.

  • height_mm – Optional explicit height in millimetres; defaults to a 4:3-ish proportion of the chosen width.

Returns:

(width_in, height_in) suitable for matplotlib.

__init__(name: str, single_column_mm: float = 89.0, double_column_mm: float = 183.0, dpi: int = 300, font_family: str = 'sans-serif', font_size: float = 8.0, line_width: float = 1.0, palette: ~typing.Tuple[str, ...] = ('#0072B2', '#D55E00', '#009E73', '#CC79A7', '#E69F00', '#56B4E9', '#F0E442', '#000000'), extra_rcparams: ~typing.Dict[str, object] = <factory>) → None