dtwPlotTwoWay {dtw} | R Documentation |
Plot a DTW results for visual inspection.
dtwPlotTwoWay(d,xts=NULL,yts=NULL, offset=0, type="o",pch=21, xlab="Index", ylab="Query value", match.col="gray70", ... )
d |
an alignment result, object of class dtw |
xts |
query vector |
yts |
template vector |
xlab,ylab |
axis labels |
offset |
displacement between the timeseries, summed to template |
match.col |
color of the match lines |
type,pch |
graphical parameters for timeseries plotting, passed to matplot |
... |
additional arguments, passed to matplot |
Display the query and template time series and their alignment, arranged so that alignment can be visually inspected.
The two vectors are displayed via the matplot
functions,
and their appearance can be customized via type
and pch
arguments (constants or vectors of two elements). If offset
is
set, the template is offset by the given amount; this will be
reflected by the right-hand axis.
Only single-variate time series can be plotted this way.
These functions are incompatible with
mechanisms for arranging plots on a device: par(mfrow)
,
layout
and split.screen
.
Values on the left axis do not reflect the template if offset
is set.
Toni Giorgino
dtwPlot
for other dtw plotting functions,
matplot
for graphical parameters.
## A noisy sine wave as query ## A cosine is for template; sin and cos are offset by 25 samples idx<-seq(0,6.28,len=100); query<-sin(idx)+runif(100)/10; template<-cos(idx) dtw(query,template,step=asymmetricP1)->alignment; ## Equivalent to plot(alignment,xts=query,yts=template,type="two"); dtwPlotTwoWay(alignment,xts=query,yts=template); ## Beware of the template's y axis, may be confusing plot(alignment,xts=query,yts=template,offset=-2,type="two"); legend("topright",c("Query","Template"), pch=21, col=1:6)