Could anyone suggest why the following example code does not work:
require(biwavelet)
t <- seq(1/24, 365, 1/24)
A <- 2
fs <- 1/24
y <- A + sin(2*pi*fs*t)
d = cbind(t,y)
wt.t1 <- wt(d)
plot(wt.t1)
It generates an error stating:
Error in image.default(x$t, yvals, t(zvals), zlim = zlims, ylim = rev(range(yvals)), :
invalid z limits
How would I fix this problem?
Additional:
In response to Gavin Simpsons answer: If I keep the data to only include one frequency but alter the time vector, the code works fine.
require(biwavelet)
A <- 2
fs <- 1/24
y <- A + sin(2*pi*fs*t)
d <- cbind(seq(1,8760), y)
wt.t1 <- wt(d)
plot(wt.t1)
I suspect this is due to the fact that you have only a single frequency here and the function isn't set up for that. I can get a plot by adding white noise to
y:You might wish to contact the maintainers to report the issue. I got the plot to do something when I debugged it and reversed
zlimso thatdiff(zlim)was positive, so it might be that the author of theplot()method was making an assumption that doesn't hold in all cases.