Interactive Plots (plotly)¶
All interactive plot functions display the figure automatically by default (show=True). Pass show=False to get the plotly.graph_objects.Figure without displaying. Features: zoom, pan, hover with sample-level values, range sliders.
Lead Waveforms¶
Interactive single lead with hover showing time/amplitude |
|
Interactive leads in a grid layout |
|
Interactive 12-lead plot with standard lead names |
- ecgdatakit.plotting.iplot_lead(lead, peaks=None, title=None, height=300, *, fs=None, show=True, x_axis='time')[source]¶
Interactive single lead with hover showing time/amplitude.
- Parameters:
lead (
Lead|ndarray[tuple[Any,...],dtype[double]]) – ECG lead or raw signal array to plot.peaks (
ndarray[tuple[Any,...],dtype[int_]] |None) – Optional R-peak indices to mark.height (
int) – Figure height in pixels.fs (
int|None) – Sample rate in Hz. Required when lead is a numpy array.show (
bool) – Display the plot immediately (defaultTrue).x_axis (
str) –"time"for seconds (default) or"samples"for sample indices.
- Return type:
Figure
- ecgdatakit.plotting.iplot_leads(leads, peaks_dict=None, title=None, height=None, *, fs=None, show=True, x_axis='time', rows=None, cols=None)[source]¶
Interactive leads in a grid layout (vertical stack by default).
- Parameters:
leads (
list[Lead] |ECGRecord|ndarray[tuple[Any,...],dtype[double]] |list[ndarray[tuple[Any,...],dtype[double]]]) – Leads to plot. Also accepts a 2-D numpy array (n_leads × n_samples) or a list of 1-D numpy arrays.peaks_dict (
dict[str,ndarray[tuple[Any,...],dtype[int_]]] |None) –{label: peaks_array}for per-lead peak markers.height (
int|None) – Figure height (auto-calculated ifNone).fs (
int|None) – Sample rate in Hz. Required when leads is a numpy array.show (
bool) – Display the plot immediately (defaultTrue).x_axis (
str) –"time"for seconds (default) or"samples"for sample indices.rows (
int|None) – Number of rows in the subplot grid. Derived from cols or defaults to one row per lead when neither is given.cols (
int|None) – Number of columns in the subplot grid (default1).
- Return type:
Figure
- ecgdatakit.plotting.iplot_12lead(leads, record=None, title=None, height=None, *, fs=None, show=True, x_axis='time', rows=None, cols=None)[source]¶
Interactive 12-lead plot with standard lead names.
Unlike
iplot_leads(), this function assigns the standard 12-lead names (I, II, III, aVR, …, V6) when the input contains unnamed leads. The full signal is plotted without cropping.- Parameters:
leads (
list[Lead] |ECGRecord|ndarray[tuple[Any,...],dtype[double]] |list[ndarray[tuple[Any,...],dtype[double]]]) – Leads (or record) to plot. Also accepts a 2-D numpy array (n_leads × n_samples) or a list of 1-D numpy arrays.record (
ECGRecord|None) – Optional record for header annotations.height (
int|None) – Figure height in pixels (auto-calculated ifNone).fs (
int|None) – Sample rate in Hz. Required when leads is a numpy array.show (
bool) – Display the plot immediately (defaultTrue).x_axis (
str) –"time"for seconds (default) or"samples"for sample indices.rows (
int|None) – Number of rows in the subplot grid. Derived from cols or defaults to one row per lead when neither is given.cols (
int|None) – Number of columns in the subplot grid (default1).
- Return type:
Figure
Annotations¶
Interactive lead with R-peak markers |
- ecgdatakit.plotting.iplot_peaks(lead, peaks=None, title=None, height=350, *, fs=None, show=True, x_axis='time')[source]¶
Interactive lead with R-peak markers.
Hover on peaks shows peak index, RR interval, and instantaneous HR.
- Parameters:
lead (
Lead|ndarray[tuple[Any,...],dtype[double]]) – ECG lead or raw signal array to plot.peaks (
ndarray[tuple[Any,...],dtype[int_]] |None) – R-peak indices. Auto-detected ifNone.fs (
int|None) – Sample rate in Hz. Required when lead is a numpy array.show (
bool) – Display the plot immediately (defaultTrue).x_axis (
str) –"time"for seconds (default) or"samples"for sample indices.title (str | None)
height (int)
- Return type:
Figure
Frequency Domain¶
Interactive spectrum with frequency band highlighting |
HRV¶
Interactive RR interval tachogram |
|
Interactive Poincaré plot with SD1/SD2 ellipse |
- ecgdatakit.plotting.iplot_rr_tachogram(rr_ms, height=300, *, show=True)[source]¶
Interactive RR interval tachogram.
Full Report¶
Interactive full ECG report |