plot.cardiPeakwindow {cardidates}R Documentation

Plot Method for cardiPeakwindow Objects

Description

This function is intended to visualize peaks identified by the peakwindow function.

Usage

## S3 method for class 'cardiPeakwindow'
plot(x, y, add=FALSE, ...)

Arguments

x

an object of class cardiPeakwindow resulting from a call to peakwindow,

y

not used, for compatibility with plot only,

add

if TRUE, highlight additional peaks in the plot,

...

other arguments passed to plot.default.

Details

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.

See Also

weibull4, weibull6, fitweibull, peakwindow, CDW cardidates

Examples

## 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")

[Package cardidates version 0.4.9 Index]