Skip to content

Index

subsurfaceio.matplotlib_utils

Shared matplotlib helpers.

Guard optional matplotlib extras before drawing:

from subsurfaceio.matplotlib_utils import require_mpl, STYLE_RC

require_mpl()

Functions:

Name Description
require_mpl

Import matplotlib extras or raise a hint to install [mpl].

Attributes:

Name Type Description
STYLE_RC dict[str, Any]

Default matplotlib rcParams for module-owned figures.

STYLE_RC module-attribute

STYLE_RC: dict[str, Any] = {
    "font.family": "Arial",
    "legend.fontsize": "small",
    "legend.title_fontsize": "small",
}

Default matplotlib rcParams for module-owned figures.

Apply with matplotlib.rc_context on plot() methods, or merge overrides (for example STYLE_RC | {'font.size': 10}), so styling is scoped to module output without mutating global matplotlib defaults.

require_mpl

require_mpl() -> None

Import matplotlib extras or raise a hint to install [mpl].

Raises:

Type Description
ImportError

If matplotlib or matplotlib_express is not installed.