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:
- datapoint
BasePepDataset Dataset to plot. Should contain ECG and ICG traces; annotations are optional.
- collapsebool, optional
If
True, plot ECG and ICG on a single axis. IfFalse, render two stacked axes (ECG above ICG). Default:False.- normalize_timebool, optional
If
True, convert the time index to seconds. IfFalse, 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_axisand_plot_signals_two_axesfor supported keyword arguments.
- datapoint
- Returns:
Notes
This function is a thin convenience wrapper that selects the appropriate renderer based on the
collapseflag: it delegates to_plot_signals_one_axiswhen a single-axis display is requested, and to_plot_signals_two_axesotherwise. 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])