# Code to help interpret arrow direction
a <- 0.5 * pi # phase difference
f <- 10
t <- 1:200
# x leads y by a = 0.5 * pi
x <- sin(t / max(t) * f * 2 * pi)
y <- sin(t / max(t) * f * 2 * pi - a)
par(mfrow = c(2, 1))
plot(t, x, t = "l")
lines(t, y, col = "red")
my_xwt <- xwt(cbind(t, x), cbind(t, y))
plot(my_xwt, plot.phase = TRUE)
# arrows pointing up indicating x leads y
Run the code above in your browser using DataLab