Skip to content

Base

subsurfaceio.plot.base

Backend-agnostic figure contract.

Classes:

Name Description
BaseFigure

A plot specification plus the machinery to render it.

BaseFigure pydantic-model

Bases: BaseModel

A plot specification plus the machinery to render it.

Rendering is a template method: plot is final and runs _render, which builds the backend figure, followed by _post_plot, the single hook subclasses extend. Both run inside _style_context, so a subclass never has to remember to re-apply styling.

Attributes:

Name Type Description
sharex bool

Share the x-axis across facets. Backends accept different values here; the matplotlib figure widens this to matplotlib's string forms.

sharey bool

Share the y-axis across facets.

plot_model DiscriminatedPlotModel

Discriminated express plot specification to render.

Fields:

fig property

fig: Any

Rendered backend figure.

Raises:

Type Description
RuntimeError

When accessed before plot.

plot_model pydantic-field

plot_model: DiscriminatedPlotModel

sharex pydantic-field

sharex: bool = True

sharey pydantic-field

sharey: bool = True

plot

plot() -> Self

Render the figure and apply every post-processing step.

Final by design. Subclasses extend rendering through _post_plot rather than overriding this method, which guarantees that the styling context is open and that _render has run first.

Returns:

Type Description
Self

Self, so callers can chain .plot().fig.