plot_signals#

pepbench.plotting.plot_signals(datapoint: BasePepDataset, *, collapse: bool = False, normalize_time: bool = False, heartbeat_subset: Sequence[int] | None = None, **kwargs: Any) tuple[Figure, Axes | Sequence[Axes]][source]#

Plot ECG and ICG signals.

Parameters:
datapointBasePepDataset

Dataset to plot. Should contain ECG and ICG traces; annotations are optional.

collapsebool, optional

If True, plot ECG and ICG on a single axis. If False, render two stacked axes (ECG above ICG). Default: False.

normalize_timebool, optional

If True, convert the time index to seconds. If False, preserve the original time index (e.g. DatetimeIndex). Default: False.

heartbeat_subsetSequence[int] | None, optional

Sequence of heartbeat indices to include in the plot. If None, all heartbeats are plotted. Default: None.

**kwargsAny

Additional plotting options forwarded to the low-level helpers (axis handling, legend placement, colours, layout, etc.). Refer to _plot_signals_one_axis and _plot_signals_two_axes for supported keyword arguments.

Returns:
(fig, ax)tuple[

Figure, Axes | Sequence[Axes] ] Matplotlib figure and axis (or sequence of axes) containing the rendered traces.

Notes

This function is a thin convenience wrapper that selects the appropriate renderer based on the collapse flag: it delegates to _plot_signals_one_axis when a single-axis display is requested, and to _plot_signals_two_axes otherwise. Default legend and layout parameters are applied here before delegation.

Examples

>>> from pepbench.plotting import plot_signals
>>> fig, ax = plot_signals(datapoint, collapse=False, normalize_time=True, heartbeat_subset=[0, 1, 2])