Plot a Continuous Wavelet Transform
This function creates a filled.contour
plot of a continuous
wavelet transform as output from morlet
.
wavelet.plot(wave.list, wavelet.levels = quantile(wave.list$Power, probs = (0:10)/10), add.coi = TRUE, add.sig = TRUE, x.lab = gettext("Time", domain = "R-dplR"), period.lab = gettext("Period", domain = "R-dplR"), crn.lab = gettext("RWI", domain = "R-dplR"), key.cols = rev(rainbow(length(wavelet.levels)-1)), key.lab = parse(text=paste0("\"", gettext("Power", domain="R-dplR"), "\"^2")), add.spline = FALSE, f = 0.5, nyrs = NULL, crn.col = "black", crn.lwd = 1,coi.col='black', crn.ylim = range(wave.list$y) * c(0.95, 1.05), side.by.side = FALSE, useRaster = FALSE, res = 150, reverse.y = FALSE, ...)
wave.list |
A |
wavelet.levels |
A |
add.coi |
A |
add.sig |
A |
x.lab |
X-axis label. |
period.lab |
Y-axis label for the wavelet plot. |
crn.lab |
Y-axis label for the time-series plot. |
key.cols |
A vector of colors for the wavelets and the key. |
key.lab |
Label for key. |
add.spline |
A |
nyrs |
A number giving the rigidity of the smoothing spline,
defaults to 0.33 of series length if |
f |
A number between 0 and 1 giving the frequency response or wavelength cutoff for the smoothing spline. Defaults to 0.5. |
crn.col |
Line color for the time-series plot. |
crn.lwd |
Line width for the time-series plot. |
coi.col |
Color for the COI if |
crn.ylim |
Axis limits for the time-series plot. |
side.by.side |
A |
useRaster |
A |
res |
A |
reverse.y |
A |
... |
Arguments passed to |
This produces a plot of a continuous wavelet transform and plots the original time series. Contours are added for significance and a cone of influence polygon can be added as well. Anything within the cone of influence should not be interpreted.
The time series can be plotted with a smoothing spline as well.
None. This function is invoked for its side effect, which is to produce a plot.
The function morlet
is a port of Torrence’s
IDL code, which can be accessed through the
Internet Archive Wayback Machine.
Andy Bunn. Patched and improved by Mikko Korpela.
Torrence, C. and Compo, G. P. (1998) A practical guide to wavelet analysis. Bulletin of the American Meteorological Society, 79(1), 61–78.
library(stats) library(utils) data(ca533) ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp") ca533.crn <- chron(ca533.rwi, prefix = "CAM", prewhiten = FALSE) Years <- time(ca533.crn) CAMstd <- ca533.crn[, 1] out.wave <- morlet(y1 = CAMstd, x1 = Years, p2 = 9, dj = 0.1, siglvl = 0.99) wavelet.plot(out.wave, useRaster = NA) # Alternative palette with better separation of colors # via: rev(RColorBrewer::brewer.pal(10, "Spectral")) specCols <- c("#5E4FA2", "#3288BD", "#66C2A5", "#ABDDA4", "#E6F598", "#FEE08B", "#FDAE61", "#F46D43", "#D53E4F", "#9E0142") wavelet.plot(out.wave, key.cols=specCols,useRaster = NA) # fewer colors levs <- quantile(out.wave$Power, probs = c(0, 0.5, 0.75, 0.9, 0.99)) wavelet.plot(out.wave, wavelet.levels = levs, add.sig = FALSE, key.cols = c("#FFFFFF", "#ABDDA4", "#FDAE61", "#D7191C"), useRaster = NA)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.