online_cpd_plotter
Online Change-Point Detection Plotter.
This module provides the OnlineCpdPlotter class that coordinates multiple visualizers and components to create comprehensive visualizations for change-point detection analysis.
- class pysatl_cpd.analysis.visualization.online.plotters.online_cpd_plotter.OnlineCpdPlotter(backend, data_provider=None, detection_trace=None, layout=None)[source]
Bases:
GenericCoordinator class for online change-point detection visualizations.
This class manages visualizers and components to create comprehensive visualizations. It provides a simplified API for setting up visualizations with configurable defaults.
- Parameters:
backend (
DrawBackend) – The plotting backend to use (MATPLOTLIB or PLOTLY).data_provider (
Optional[DataProvider[Any,TimeseriesAnnotation]]) – The data provider containing observations.detection_trace (
Optional[OnlineDetectionTrace[TypeVar(StateT, bound=OnlineAlgorithmState)]]) – The detection trace from online algorithm execution.layout (
ILayoutStrategy|str|None) –Layout strategy to use. Can be:
An ILayoutStrategy instance
One of: “vertical”, “split”, “dashboard-lite”, “dashboard”
None (defaults to “vertical”)
- __init__(backend, data_provider=None, detection_trace=None, layout=None)[source]
- Parameters:
backend (DrawBackend)
data_provider (DataProvider[Any, TimeseriesAnnotation] | None)
detection_trace (OnlineDetectionTrace | None)
layout (ILayoutStrategy | str | None)
- Return type:
None
- property backend: DrawBackend
Return the plotting backend used by this visualizer.
- Returns:
Current backend (MATPLOTLIB or PLOTLY).
- Return type:
DrawBackend
- set_data_provider(data_provider)[source]
Set the data provider for the timeseries visualizer.
- Parameters:
data_provider (
DataProvider[Any,TimeseriesAnnotation]) – Data provider containing observations.- Returns:
Returns self to allow method chaining.
- Return type:
Self
- set_timeseries_visualizer(timeseries_visualizer)[source]
Replace the timeseries visualizer coordinated by this plotter.
- Return type:
Self- Parameters:
timeseries_visualizer (ITimeseriesVisualizer[Any])
- set_detection_trace(detection_trace)[source]
Set the detection trace for the trace visualizer.
- Parameters:
detection_trace (
OnlineDetectionTrace[TypeVar(StateT, bound=OnlineAlgorithmState)]) – Detection trace from online algorithm execution.- Returns:
Returns self to allow method chaining.
- Return type:
Self
- set_ground_truth(change_points, margin=0)[source]
Set ground truth change points and margin.
- Parameters:
- Returns:
Returns self to allow method chaining.
- Return type:
Self
- set_legend_axis(axis_name)[source]
Set the axis where legend should be displayed for detection components.
- add_component(name, component, axes_names, show_legend=True)[source]
Add a visual component to the plotter.
- Parameters:
name (
str) – Name to identify the component.component (
IVisualComponent) – Component instance to add.axes_names (
list[str]) – Names of axes where the component should be drawn. Must be provided.show_legend (
bool) – Whether to show legend for this component.
- Returns:
Returns self to allow method chaining.
- Return type:
Self
- remove_component(name)[source]
Remove a component from the plotter.
- Parameters:
name (
str) – Name of the component to remove.- Returns:
Returns self to allow method chaining.
- Return type:
Self
- get_component(name)[source]
Get a component by name.
- Parameters:
name (
str) – Name of the component to retrieve.- Returns:
The component instance or None if not found.
- Return type:
- property required_axes: set[str]
Return the set of all axes names required by visualizers and components.
- Returns:
Set of subplot names needed for drawing.
- Return type:
set[str]
- set_layout(layout)[source]
Set the layout strategy for this plotter.
- Parameters:
layout (
ILayoutStrategy|str) –Layout strategy to use. Can be:
An ILayoutStrategy instance
One of: “vertical”, “split”, “dashboard-lite”, “dashboard”
- Returns:
Returns self to allow method chaining.
- Return type:
Self