plot_rundtw: Plot

plot.rundtwR Documentation

Plot

Description

Plot the results from rundtw.

Usage

## S3 method for class 'rundtw'
plot(x, knn = TRUE, minima = TRUE, 
     scale = c("none", "01", "z"), 
     selDim = 1, lix = 1, Q = NULL, C = NULL, normalize = c("none", "01", "z"),  ...)

Arguments

x

output from rundtw

knn

logical, if TRUE ( = default) and the k nearest neighbors were found by rundtw, then they are plotted. See details.

minima

logical, if TRUE ( = default) and Q is either passed or also returned by rundtw then the local (with window size of the lengh of Q) minima of the vector of distances is plotted. See details.

scale

character, one of c("none", "01", "z"). If "01" or "z" then the detected minima and knn are normed and plotted.

selDim

integer vector, default = 1. Set the dimensions to be plotted for multivariate time series Q and C.

lix

list index, integer, default = 1. If C is a list of time series, set with lix the list entry of C to be plotted.

Q

time series, default = NULL, either passed as list entry of x (when the parameter return_QC of rundtw is set to TRUE) or passed manually. Necessary for plotting the minima.

C

time series, default = NULL, either passed as list entry of x (when the parameter return_QC or rundtw is set to TRUE) or passed manually. Necessary for plotting the minima and knn.

normalize

deprecated, use scale instead. If normalize is set, then scale is overwritten by normalize for compatibility.

...

additional arguments passed to ggplot()

Details

Only for those subsequences for which the calculations were finished by rundtw, the distances are plotted (see the parameters threshold, k and early_abandon of rundtw).

See Also

rundtw

Examples


#--- Simulate a query pattern Q and a longer time series C,
# and detect rescaled versions of Q in C
set.seed(123)
Q <- sin(seq(0, 2*pi, length.out = 20))
Q_rescaled <- Q * abs(rnorm(1)) + rnorm(1)
C <- c(rnorm(20), Q_rescaled , rnorm(20))

# Force rundtw to finish all calculations and plot the vector of DTW distances
ret <- rundtw(Q, C, threshold = NULL, lower_bound = FALSE)
ret
plot(ret)

# Allow early abandoning and lower bounding, and also plot C
ret <- rundtw(Q, C, return_QC = TRUE, ws = 5)
ret
plot(ret)

# Get 1 nearest neighbor -> allow early abandon and lower bounding,
# and plot C and also plot the scaled detected nearest neighbors
ret <- rundtw(Q, C, ws = 5, k = 1, return_QC = TRUE)
ret
plot(ret, scale = "01")


#--- See the help page of rundtw() for further examples.


IncDTW documentation built on March 18, 2022, 6:43 p.m.