dtwPlot: Plotting of dynamic time warp results

dtwPlotR Documentation

Plotting of dynamic time warp results

Description

Methods for plotting dynamic time warp alignment objects returned by dtw().

Usage

## S3 method for class 'dtw'
plot(x, type = "alignment", ...)

dtwPlotAlignment(
  d,
  xlab = "Query index",
  ylab = "Reference index",
  plot.type = "l",
  ...
)

Arguments

x, d

dtw object, usually result of call to dtw()

type

general style for the plot, see below

...

additional arguments, passed to plotting functions

xlab

label for the query axis

ylab

label for the reference axis

plot.type

type of line to be drawn, used as the type argument in the underlying plot call

Details

dtwPlot displays alignment contained in dtw objects.

Various plotting styles are available, passing strings to the type argument (may be abbreviated):

  • alignment plots the warping curve in d;

  • twoway plots a point-by-point comparison, with matching lines; see dtwPlotTwoWay();

  • threeway vis-a-vis inspection of the timeseries and their warping curve; see dtwPlotThreeWay();

  • density displays the cumulative cost landscape with the warping path overimposed; see dtwPlotDensity()

Additional parameters are passed to the plotting functions: use with care.

Warning

These functions are incompatible with mechanisms for arranging plots on a device: par(mfrow), layout and split.screen.

Author(s)

Toni Giorgino

See Also

dtwPlotTwoWay(), dtwPlotThreeWay() and dtwPlotDensity() for details on the respective plotting styles.

Other plot: dtwPlotDensity(), dtwPlotThreeWay(), dtwPlotTwoWay()

Examples


## Same example as in dtw

idx<-seq(0,6.28,len=100);
query<-sin(idx)+runif(100)/10;
reference<-cos(idx)

alignment<-dtw(query,reference,keep=TRUE);

# A sample of the plot styles. See individual plotting functions for details

plot(alignment, type="alignment",
  main="DTW sine/cosine: simple alignment plot")
  
plot(alignment, type="twoway",
  main="DTW sine/cosine: dtwPlotTwoWay")

plot(alignment, type="threeway",
  main="DTW sine/cosine: dtwPlotThreeWay")
  
plot(alignment, type="density",
  main="DTW sine/cosine: dtwPlotDensity")
  

dtw documentation built on Sept. 20, 2022, 1:06 a.m.