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)
| 22 | import numpy |
| 23 | |
| 24 | def dtwPlot(x, type="alignment", **kwargs): |
| 25 | # IMPORT_RDOCSTRING plot.dtw |
| 26 | """Plotting of dynamic time warp results |
| 27 | |
| 28 | Methods for plotting dynamic time warp alignment objects returned by |
| 29 | [dtw()]. |
| 30 | |
| 31 | **Details** |
| 32 | |
| 33 | ``dtwPlot`` displays alignment contained in ``dtw`` objects. |
| 34 | |
| 35 | Various plotting styles are available, passing strings to the ``type`` |
| 36 | argument (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 | |
| 46 | Additional parameters are passed to the plotting functions: use with |
| 47 | care. |
| 48 | |
| 49 | Parameters |
| 50 | ---------- |
| 51 | x,d : |
| 52 | `dtw` object, usually result of call to [dtw()] |
| 53 | xlab : |
| 54 | label for the query axis |
| 55 | ylab : |
| 56 | label for the reference axis |
| 57 | type : |
| 58 | general style for the plot, see below |
| 59 | plot_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 | |
| 79 | def dtwPlotAlignment(d, xlab="Query index", ylab="Reference index", **kwargs): |
no test coverage detected