# NOT RUN {
## first align profiles:
dtwAlignment <- dtwSP(SPpairs$A_modeled, SPpairs$A_manual, open.end = FALSE)
## then plot cost density:
plotCostDensitySP(dtwAlignment)
## label height instead of layer index, and don't show warping path:
plotCostDensitySP(dtwAlignment, labelHeight = TRUE, pathCol = "transparent")
## draw lines to the cell that corresponds to the DH and SH layers
plotCostDensitySP(dtwAlignment, target = c(191, 208))
## "moving target", i.e., draw warping path only from origin to target:
plotCostDensitySP(dtwAlignment, target = 200, movingTarget = TRUE)
plotCostDensitySP(dtwAlignment, target = 266, movingTarget = TRUE)
## A cool GIF can be created from frames like those
create_GIF <- FALSE
if (create_GIF){
nPath <- length(dtwAlignment$index1)
resolution <- 100 # i.e. super low, make value smaller for smoother GIF
for (k in seq(1, nPath, by = resolution)) {
plotCostDensitySP(dtwAlignment, target = k, movingTarget = TRUE)
}
}
# }
Run the code above in your browser using DataLab