Skip to content

Commit 96d7a54

Browse files
committed
plot_items skips empty ann_samp items
1 parent 4af991c commit 96d7a54

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

wfdb/plot/plot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ def plot_items(signal=None, ann_samp=None, ann_sym=None, fs=None,
2424
ann_samp: list, optional
2525
A list of annotation locations to plot, with each list item
2626
corresponding to a different channel. List items may be:
27-
- 1d numpy array, with values representing sample indices
28-
- list, with values representing sample indices
27+
- 1d numpy array, with values representing sample indices. Empty
28+
arrays are skipped.
29+
- list, with values representing sample indices. Empty lists
30+
are skipped.
2931
- None. For channels in which nothing is to be plotted.
3032
If `signal` is defined, the annotation locations will be overlaid on
3133
the signals, with the list index corresponding to the signal channel.
@@ -188,7 +190,7 @@ def plot_annotation(ann_samp, n_annot, ann_sym, signal, n_sig, fs, time_units,
188190

189191
# Plot the annotations
190192
for ch in range(n_annot):
191-
if ann_samp[ch] is not None:
193+
if ann_samp[ch] is not None and len(ann_samp[ch]):
192194
# Figure out the y values to plot on a channel basis
193195

194196
# 1 dimensional signals

0 commit comments

Comments
 (0)