ivisual_component

Visualization component interfaces.

This module defines the abstract source class for composable visualizers components that draw specific elements (change points, segments, annotations) onto a single subplot. Components are backend-agnostic and provide separate implementations for Matplotlib and Plotly backends.

Components must support optional legend entries with the ability to toggle visibility interactively in Plotly through legend groups.

class pysatl_cpd.analysis.visualization.abstracts.ivisual_component.IVisualComponent(backend)[source]

Bases: ABC

Base interface for composable visualizers components.

Components are responsible for drawing specific elements (e.g., change points, segments, annotations) onto a single subplot. They are backend-agnostic and implement both Matplotlib and Plotly drawing methods.

Parameters:

backend (DrawBackend | str) – The backend to use for drawing operations.

__init__(backend)[source]
Parameters:

backend (DrawBackend | str)

Return type:

None

property backend: DrawBackend

Return the current drawing backend.

draw(figure, axes, add_legend=False)[source]
Overloads:
  • self, figure (PltFigure), axes (PltAxes), add_legend (bool) → None

  • self, figure (GoFigure), axes (GoAxes), add_legend (bool) → None

Parameters:
Return type:

None

Draw component on a subplot.

Parameters:
  • figure (Figure | Figure) – The figure containing the subplot (Matplotlib or Plotly).

  • axes (tuple[int, int] | Axes) – The subplot data to draw on.

  • add_legend (bool) – Whether to add (for Matplotlib) or display (for Plotly) legend entry for this component.

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

  • ValueError – If drawing with legend when label is not set, or if an unsupported backend is provided.

Return type:

None