Plotting API Reference¶
Import: from ecgdatakit.plotting import ...
Static plots require: pip install ecgdatakit[plotting] (matplotlib >= 3.7)
Interactive plots require: pip install ecgdatakit[plotting-interactive] (plotly >= 5.15)
Note
All plotting functions accept raw numpy arrays in addition to Lead / ECGRecord objects. When passing numpy arrays, provide the sample rate via fs:
# Single-lead: 1-D array
plot_lead(my_array, fs=500)
# Multi-lead: 2-D array (n_leads × n_samples)
plot_leads(signals_2d, fs=500)
A TypeError is raised if fs is omitted with a numpy array. When passing Lead / ECGRecord objects, fs is ignored.
Static Plots (matplotlib)¶
Lead Waveforms¶
Plot a single ECG lead waveform |
|
Plot multiple leads in a grid layout |
|
Plot 12 leads with standard lead names (I, II, III, aVR, …, V6) |
Annotations & Beats¶
Plot lead with R-peak markers and RR interval annotations |
|
Plot segmented heartbeats |
|
Plot ensemble-averaged beat with ±1 SD shading |
Frequency Domain¶
Plot power spectral density or FFT magnitude spectrum |
|
Plot time-frequency spectrogram (STFT) |
HRV¶
Plot RR interval tachogram |
|
Poincaré plot: RR(n) vs RR(n+1) with SD1/SD2 ellipse |
|
Combined HRV dashboard: tachogram, Poincaré, frequency bands, metrics |
Quality & Report¶
Signal quality dashboard: SQI bar chart per lead |
|
Comprehensive ECG report page |
Interactive Plots (plotly)¶
Lead Waveforms¶
Interactive single lead with hover showing time/amplitude |
|
Interactive leads in a grid layout |
|
Interactive 12-lead plot with standard lead names |
Annotations & Frequency Domain¶
Interactive lead with R-peak markers |
|
Interactive spectrum with frequency band highlighting |
HRV & Report¶
Interactive RR interval tachogram |
|
Interactive Poincaré plot with SD1/SD2 ellipse |
|
Interactive full ECG report |