Skip to content

Commit 0de1a9d

Browse files
author
Benjamin Moody
committed
plot_items: accept non-smooth signal data as input.
When plotting signals, in addition to allowing the signal argument to be a one-dimensional or two-dimensional array, allow it to be a list of one-dimensional arrays (so that each channel can have a different length.)
1 parent be23d6a commit 0de1a9d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

wfdb/plot/plot.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,12 @@ def plot_items(signal=None, ann_samp=None, ann_sym=None, fs=None,
123123
124124
Parameters
125125
----------
126-
signal : 1d or 2d numpy array, optional
127-
The uniformly sampled signal to be plotted. If signal.ndim is 1, it is
128-
assumed to be a one channel signal. If it is 2, axes 0 and 1, must
129-
represent time and channel number respectively.
126+
signal : 1d or 2d numpy array or list, optional
127+
The uniformly sampled signal or signals to be plotted. If signal
128+
is a one-dimensional array, it is assumed to represent a single
129+
channel. If it is a two-dimensional array, axes 0 and 1 must
130+
represent time and channel number respectively. Otherwise it must
131+
be a list of one-dimensional arrays (one for each channel).
130132
ann_samp: list, optional
131133
A list of annotation locations to plot, with each list item
132134
corresponding to a different channel. List items may be:
@@ -222,6 +224,9 @@ def plot_items(signal=None, ann_samp=None, ann_sym=None, fs=None,
222224
"""
223225
import matplotlib.pyplot as plt
224226

227+
# Convert signal to a list if needed
228+
signal = _expand_channels(signal)
229+
225230
# Figure out number of subplots required
226231
sig_len, n_sig, n_annot, n_subplots = get_plot_dims(signal, ann_samp)
227232

0 commit comments

Comments
 (0)