Skip to content

Commit fe50565

Browse files
committed
fix #140
1 parent f9332e7 commit fe50565

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dtw/dtwPlot.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ def dtwPlotTwoWay(d, xts=None, yts=None,
159159
except:
160160
raise ValueError("Original timeseries are required")
161161

162+
if xts.shape[1] != 1 or yts.shape[1] != 1:
163+
raise ValueError("Only single-variate timeseries can be plotted in the two-way style")
164+
162165
# ytso = yts + offset
163166
offset = -offset
164167

@@ -191,8 +194,8 @@ def dtwPlotTwoWay(d, xts=None, yts=None,
191194

192195
col = []
193196
for i in idx:
194-
col.append([(d.index1[i], xts[d.index1[i]]),
195-
(d.index2[i], -offset + yts[d.index2[i]])])
197+
col.append([(float(d.index1[i]), xts[d.index1[i],0]),
198+
(float(d.index2[i]), -offset + yts[d.index2[i],0])])
196199

197200
lc = mc.LineCollection(col, linewidths=1, linestyles=":", colors=match_col)
198201
ax.add_collection(lc)

0 commit comments

Comments
 (0)