plot.cardiPeakwindow | R Documentation |
This function is intended to visualize peaks identified by the peakwindow function.
## S3 method for class 'cardiPeakwindow'
plot(x, y, add=FALSE, ...)
x |
an object of class |
y |
not used, for compatibility with plot only, |
add |
if TRUE, highlight additional peaks in the plot, |
... |
other arguments passed to |
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.