ivisualizer

Visualization interfaces for change-point detection results.

This module defines abstract source classes for visualizers that render time series data, detection traces, and algorithm performance metrics using either Matplotlib or Plotly backends.

class pysatl_cpd.analysis.visualization.abstracts.ivisualizer.IVisualizer(backend)[source]

Bases: ABC

Abstract source class for all visualizers.

This interface defines the contract for visualizers that render data onto specific subplots within a figure. Each visualizer declares which subplot axes it requires and provides backend-specific drawing methods.

The visualizer pattern enables composable figure construction, where a coordinator creates a figure with named subplots, and each visualizer draws its content onto its designated axes.

Parameters:

backend (DrawBackend | str) – Plotting backend to use for rendering (MATPLOTLIB or PLOTLY).

__init__(backend)[source]
Parameters:

backend (DrawBackend | str)

Return type:

None

property backend: DrawBackend

Return the plotting backend used by this visualizer.

Returns:

Current backend (MATPLOTLIB or PLOTLY).

Return type:

DrawBackend

abstract property axes: set[str]

Declare the subplot names required by this visualizer.

Returns:

Set of subplot identifiers that this visualizer will draw onto. These names must correspond to axes provided in the AxMapping when the draw method is called.

Return type:

set[str]

Raises:

NotImplementedError – Subclasses must implement this property.

draw(*, figure, axes)[source]
Overloads:
  • self, figure (PltFigure), axes (PltAxMapping) → PltFigure

  • self, figure (GoFigure), axes (GoAxMapping) → GoFigure

Parameters:
Return type:

Figure

Draw content onto the specified axes.

This method dispatches to the appropriate backend-specific implementation based on the backend argument. The figure is inferred from the axes objects (for Matplotlib) or created automatically (for Plotly).

Parameters:
  • figure (Figure | Figure) – The figure to draw onto (Matplotlib or Plotly).

  • axes (dict[str, Axes] | dict[str, tuple[int, int]]) – Mapping from subplot names to their axes objects or positions.

Returns:

The modified figure object.

Return type:

Figure

Raises:
  • TypeError – If the figure or axes mapping type does not match the backend.

  • ValueError – If the backend is not supported.