phenotypic.abc_.FigureProvider#

class phenotypic.abc_.FigureProvider[source]#

Bases: object

Mixin turning @figure methods into .inspect() / .dash() / a dashboard.

Methods only — no fields, no __init__, no instance state — so it is safe to mix into any pydantic.BaseModel in any MRO position (mirrors LazyWidgetMixin). Mix it into the concrete class that owns the @figure methods:

class DiagnosticsPlotter(BasePlotter, FigureProvider): ...
class MeasureSymmetricZones(MeasureFeatures, FigureProvider): ...
Subject binding:
  • Helpers hold their subject — override _figure_subject() to return it; their @figure methods read self and take no subject.

  • Operations pass the subject at call time (op.dash(image)); their @figure methods take it as the first positional parameter.

Methods

__init__

dash

The interactive view.

figures

Bind subject → a transient BoundFigures the Dash adapter consumes.

inspect

The primary saveable go.Figure.

iter_figures

All @figure specs on this instance's class, in definition order.

iter_figures() list[FigureSpec][source]#

All @figure specs on this instance’s class, in definition order.

Walks the MRO so inherited figures are included. Normal Python override semantics apply: a subclass method without @figure shadows and removes the inherited figure, while a redecorated override keeps the inherited figure’s original position.

Return type:

list[FigureSpec]

inspect(subject: Any = None, *, for_save: bool = False, **overrides: Any) go.Figure[source]#

The primary saveable go.Figure.

This is the default inspect() contract used by control-free helpers and by the CLI’s --save-inspect. Classes that hand-write their own inspect (e.g. MeasureSymmetricZones) override this naturally.

Parameters:
  • subject (Any) – Subject to render against (operations); None uses the held subject (helpers).

  • for_save (bool) – Forwarded to the figure method if it accepts for_save (so legend-only layers can be flattened for a static raster).

  • **overrides (Any) – Override control defaults by keyword.

Returns:

The themed primary plotly.graph_objects.Figure.

Return type:

go.Figure

dash(subject: Any = None) Any[source]#

The interactive view.

  • No Control anywhere → a composed subplot go.Figure (preserving the repo-wide .dash() -> go.Figure contract).

  • Any Control present → the ipywidgets notebook dashboard.

Parameters:

subject (Any) – Subject to bind (operations); None uses the held subject.

Returns:

A go.Figure (control-free) or an ipywidgets widget (controls).

Return type:

Any

figures(subject: Any = None) BoundFigures[source]#

Bind subject → a transient BoundFigures the Dash adapter consumes. The per-render cache lives on the returned object, not here.

Parameters:

subject (Any)

Return type:

BoundFigures