dtwPlotThreeWay | R Documentation |
Display the query and reference time series and their warping curve, arranged for visual inspection.
dtwPlotThreeWay( d, xts = NULL, yts = NULL, type.align = "l", type.ts = "l", match.indices = NULL, margin = 4, inner.margin = 0.2, title.margin = 1.5, xlab = "Query index", ylab = "Reference index", main = "Timeseries alignment", ... )
d |
an alignment result, object of class |
xts |
query vector |
yts |
reference vector |
type.align |
line style for warping curve plot |
type.ts |
line style for timeseries plot |
match.indices |
indices for which to draw a visual guide |
margin |
outer figure margin |
inner.margin |
inner figure margin |
title.margin |
space on the top of figure |
xlab |
label for the query axis |
ylab |
label for the reference axis |
main |
main title |
... |
additional arguments, used for the warping curve |
The query time series is plotted in the bottom panel, with indices growing rightwards and values upwards. Reference is in the left panel, indices growing upwards and values leftwards. The warping curve panel matches indices, and therefore element (1,1) will be at the lower left, (N,M) at the upper right.
Argument match.indices
is used to draw a visual guide to matches; if
a vector is given, guides are drawn for the corresponding indices in the
warping curve (match lines). If integer, it is used as the number of guides
to be plotted. The corresponding style is customized via the
match.col
and match.lty
arguments.
If xts
and yts
are not supplied, they will be recovered from
d
, as long as it was created with the two-argument call of
dtw()
with keep.internals=TRUE
. Only single-variate time
series can be plotted.
The function is incompatible with mechanisms for arranging
plots on a device: par(mfrow)
, layout
and split.screen
.
Appearance of the match lines and timeseries currently can not be
customized.
Toni Giorgino
Other plot:
dtwPlotDensity()
,
dtwPlotTwoWay()
,
dtwPlot()
## A noisy sine wave as query ## A cosine is for reference; sin and cos are offset by 25 samples idx<-seq(0,6.28,len=100); query<-sin(idx)+runif(100)/10; reference<-cos(idx) dtw(query,reference,keep=TRUE)->alignment; ## Beware of the reference's y axis, may be confusing ## Equivalent to plot(alignment,type="three"); dtwPlotThreeWay(alignment); ## Highlight matches of chosen QUERY indices. We will do some index ## arithmetics to recover the corresponding indices along the warping ## curve hq <- (0:8)/8 hq <- round(hq*100) # indices in query for pi/4 .. 7/4 pi hw <- (alignment$index1 %in% hq) # where are they on the w. curve? hi <- (1:length(alignment$index1))[hw]; # get the indices of TRUE elems dtwPlotThreeWay(alignment,match.indices=hi);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.