Learn R Programming

dtwSat (version 0.2.8)

plotMatches: Plotting matching points

Description

Method for plotting the matching points from TWDTW analysis.

Usage

plotMatches(
  x,
  timeseries.labels = 1,
  patterns.labels = NULL,
  k = 1,
  attr = 1,
  shift = 0.5,
  show.dist = FALSE
)

Value

A ggplot object.

Arguments

x

An object of class twdtwMatches.

timeseries.labels

The label or index of the time series. Default is 1.

patterns.labels

A vector with labels of the patterns. If not declared the function will plot one alignment for each pattern.

k

A positive integer. The index of the last alignment to include in the plot. If not declared the function will plot the best match for each pattern.

attr

An integer or character vector indicating the attribute for plotting. Default is 1.

shift

A number that shifts the pattern position in the x direction. Default is 0.5.

show.dist

Show the distance for each alignment. Default is FALSE.

Author

Victor Maus, vwmaus1@gmail.com

References

Maus:2019dtwSat

Maus:2016dtwSat

See Also

twdtwMatches-class, twdtwApply, plotPaths, plotCostMatrix, plotAlignments, and plotClassification.

Examples

Run this code
log_fun = logisticWeight(-0.1, 100)
ts = twdtwTimeSeries(MOD13Q1.ts.list)
patt = twdtwTimeSeries(MOD13Q1.patterns.list)
mat1 = twdtwApply(x=ts, y=patt, weight.fun=log_fun, keep=TRUE, legacy=TRUE)

plotMatches(mat1)

plotMatches(mat1, patterns.labels="Soybean", k=4)

plotMatches(mat1, patterns.labels=c("Soybean","Maize"), k=4)

plotMatches(mat1, patterns.labels=c("Soybean","Cotton"), k=c(3,1))

Run the code above in your browser using DataLab