
This function is intended to visualize peaks identified by the peakwindow function.
# S3 method for cardiPeakwindow
plot(x, y, add=FALSE, ...)
an object of class cardiPeakwindow
resulting from a call
to peakwindow
,
not used, for compatibility with plot only,
if TRUE, highlight additional peaks in the plot,
other arguments passed to plot.default
.
Peaks identified by peakwindow
are labelled with their
coresponding peak numbers. The first peak which occurs after xstart
(e.g. spring peak in biological time series) is highlighted with red color.
weibull4
,
weibull6
,
fitweibull
,
peakwindow
,
CDW
cardidates
## generate artificial test data
set.seed(123)
x <- seq(1, 365 * 3, 18)
y <- rlnorm(x, sd = 0.6) + 5e-5 * exp(1e-4 * ((x - 100) %% 365)^2) +
1e-4 * exp(3e-4 * ((x - 220) %% 200)^2)
## identify peaks and mark first peak after a certain time x
peaks <- peakwindow(x, y, xstart = 55)
## plot it
plot(peaks)
# highlight peaks of other years
peaks2 <- peakwindow(x, y, xstart = 420)
peaks3 <- peakwindow(x, y, xstart = 785)
plot(peaks2, add = TRUE)
plot(peaks3, add = TRUE)
## mark years
abline(v = seq(0, 365 * 3, 365), col = "grey")
Run the code above in your browser using DataLab