MCPcopy Index your code
hub / github.com/DynamicTimeWarping/dtw-python / dtwPlot

Function dtwPlot

dtw/dtwPlot.py:24–76  ·  view source on GitHub ↗

Plotting of dynamic time warp results Methods for plotting dynamic time warp alignment objects returned by [dtw()]. **Details** ``dtwPlot`` displays alignment contained in ``dtw`` objects. Various plotting styles are available, passing strings to the ``type`` argument (may be abbreviated): - ``

(x, type="alignment", **kwargs)

Source from the content-addressed store, hash-verified

22import numpy
23
24def dtwPlot(x, type="alignment", **kwargs):
25 # IMPORT_RDOCSTRING plot.dtw
26 """Plotting of dynamic time warp results
27
28Methods for plotting dynamic time warp alignment objects returned by
29[dtw()].
30
31**Details**
32
33``dtwPlot`` displays alignment contained in ``dtw`` objects.
34
35Various plotting styles are available, passing strings to the ``type``
36argument (may be abbreviated):
37
38- ``alignment`` plots the warping curve in ``d``;
39- ``twoway`` plots a point-by-point comparison, with matching lines; see
40 [dtwPlotTwoWay()];
41- ``threeway`` vis-a-vis inspection of the timeseries and their warping
42 curve; see [dtwPlotThreeWay()];
43- ``density`` displays the cumulative cost landscape with the warping
44 path overimposed; see [dtwPlotDensity()]
45
46Additional parameters are passed to the plotting functions: use with
47care.
48
49Parameters
50----------
51x,d :
52 `dtw` object, usually result of call to [dtw()]
53xlab :
54 label for the query axis
55ylab :
56 label for the reference axis
57type :
58 general style for the plot, see below
59plot_type :
60 type of line to be drawn, used as the `type` argument in the underlying `plot` call
61... :
62 additional arguments, passed to plotting functions
63
64"""
65 # ENDIMPORT
66
67 if type == "alignment":
68 return dtwPlotAlignment(x, **kwargs)
69 elif type == "twoway":
70 return dtwPlotTwoWay(x, **kwargs)
71 elif type == "threeway":
72 return dtwPlotThreeWay(x, **kwargs)
73 elif type == "density":
74 return dtwPlotDensity(x, **kwargs)
75 else:
76 raise ValueError("Unknown plot type: " + type)
77
78
79def dtwPlotAlignment(d, xlab="Query index", ylab="Reference index", **kwargs):

Callers 1

plotMethod · 0.85

Calls 4

dtwPlotAlignmentFunction · 0.85
dtwPlotTwoWayFunction · 0.85
dtwPlotThreeWayFunction · 0.85
dtwPlotDensityFunction · 0.85

Tested by

no test coverage detected