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

iplot_lead()

Interactive single lead with hover showing time/amplitude

iplot_leads()

Interactive leads in a grid layout

iplot_12lead()

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.

  • title (str | None) – Figure title.

  • 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 (default True).

  • 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.

  • title (str | None) – Overall title.

  • height (int | None) – Figure height (auto-calculated if None).

  • fs (int | None) – Sample rate in Hz. Required when leads is a numpy array.

  • show (bool) – Display the plot immediately (default True).

  • 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 (default 1).

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.

  • title (str | None) – Overall figure title.

  • height (int | None) – Figure height in pixels (auto-calculated if None).

  • fs (int | None) – Sample rate in Hz. Required when leads is a numpy array.

  • show (bool) – Display the plot immediately (default True).

  • 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 (default 1).

Return type:

Figure

Annotations

iplot_peaks()

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 if None.

  • fs (int | None) – Sample rate in Hz. Required when lead is a numpy array.

  • show (bool) – Display the plot immediately (default True).

  • x_axis (str) – "time" for seconds (default) or "samples" for sample indices.

  • title (str | None)

  • height (int)

Return type:

Figure

Frequency Domain

iplot_spectrum()

Interactive spectrum with frequency band highlighting

ecgdatakit.plotting.iplot_spectrum(lead, method='welch', height=400, *, fs=None, show=True)[source]

Interactive spectrum with frequency band highlighting.

Parameters:
  • lead (Lead | ndarray[tuple[Any, ...], dtype[double]]) – ECG lead or raw signal array.

  • method (str) – "welch" for PSD or "fft" for magnitude spectrum.

  • fs (int | None) – Sample rate in Hz. Required when lead is a numpy array.

  • show (bool) – Display the plot immediately (default True).

  • height (int)

Return type:

Figure

HRV

iplot_rr_tachogram()

Interactive RR interval tachogram

iplot_poincare()

Interactive Poincaré plot with SD1/SD2 ellipse

ecgdatakit.plotting.iplot_rr_tachogram(rr_ms, height=300, *, show=True)[source]

Interactive RR interval tachogram.

Parameters:
Return type:

Figure

ecgdatakit.plotting.iplot_poincare(rr_ms, height=500, *, show=True)[source]

Interactive Poincaré plot with SD1/SD2 ellipse.

Parameters:
Return type:

Figure

Full Report

iplot_report()

Interactive full ECG report

ecgdatakit.plotting.iplot_report(record, height=1200, *, show=True, x_axis='time')[source]

Interactive full ECG report.

Parameters:
  • record (ECGRecord) – Full ECG record.

  • show (bool) – Display the plot immediately (default True).

  • x_axis (str) – "time" for seconds (default) or "samples" for sample indices.

  • height (int)

Return type:

Figure