Skip to content

Commit

Permalink
Fix #33
Browse files Browse the repository at this point in the history
  • Loading branch information
tonigi committed Sep 1, 2022
1 parent 0872a21 commit 8c79531
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions dtw/dtwPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,16 @@ def dtwPlotTwoWay(d, xts=None, yts=None,
# ytso = yts + offset
offset = -offset

maxlen = max(len(xts), len(yts))
times = numpy.arange(maxlen)
xts = numpy.pad(xts,(0,maxlen-len(xts)),"constant",constant_values=numpy.nan)
yts = numpy.pad(yts,(0,maxlen-len(yts)),"constant",constant_values=numpy.nan)
xtimes = numpy.arange(len(xts))
ytimes = numpy.arange(len(yts))

fig, ax = plt.subplots()

ax.set_xlabel(xlab)
ax.set_ylabel(ylab)

ax.plot(times, xts, color='k', **kwargs)
ax.plot(times, yts - offset, **kwargs) # Plot with offset applied
ax.plot(xtimes, xts, color='k', **kwargs)
ax.plot(ytimes, yts - offset, **kwargs) # Plot with offset applied

if offset != 0:
# Create an offset axis
Expand Down

0 comments on commit 8c79531

Please sign in to comment.