[Dplr-commits] r668 - in branches/redfit: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 27 23:38:11 CEST 2013


Author: andybunn
Date: 2013-08-27 23:38:10 +0200 (Tue, 27 Aug 2013)
New Revision: 668

Modified:
   branches/redfit/R/wavelet.plot.R
   branches/redfit/man/wavelet.plot.Rd
Log:
added a coi.col argument at the request of a useR.

Modified: branches/redfit/R/wavelet.plot.R
===================================================================
--- branches/redfit/R/wavelet.plot.R	2013-08-27 16:32:53 UTC (rev 667)
+++ branches/redfit/R/wavelet.plot.R	2013-08-27 21:38:10 UTC (rev 668)
@@ -1,207 +1,207 @@
-wavelet.plot <-
-    function(wave.list,
-             wavelet.levels = quantile(wave.list$Power, probs=seq(from=0, to=1, by=0.1)),
-             add.coi = TRUE, add.sig = TRUE, x.lab = gettext("Time"),
-             period.lab = gettext("Period"), crn.lab = gettext("RWI"),
-             key.cols = rev(rainbow(length(wavelet.levels)-1)),
-             key.lab = parse(text = paste0("\"", gettext("Power"), "\"^2")),
-             add.spline = FALSE, f = 0.5, nyrs = NULL,
-             crn.col = "black", crn.lwd = 1,
-             crn.ylim = range(wave.list$y)*1.1, side.by.side = FALSE)
-{
-
-    ## Wavelet transform variables:
-    y <- wave.list$y
-    x <- wave.list$x
-    wave <- wave.list$wave
-    period <- wave.list$period
-    Signif <- wave.list$Signif
-    coi <- wave.list$coi
-    coi[coi == 0] <- 1e-12
-    Power <- wave.list$Power
-    siglvl <- wave.list$siglvl
-
-    if (any(diff(x) <= 0) || any(diff(period) <= 0)) {
-        stop("'wave.list$x' and 'wave.list$period' must be strictly ascending")
-    }
-    if (period[1] <= 0) {
-        stop("'wave.list$period' must be positive")
-    }
-
-    ## Expand signif --> (length(wave.list$Scale))x(N) array
-    Signif <- t(matrix(Signif, dim(wave)[2], dim(wave)[1]))
-    ## Where ratio > 1, power is significant
-    Signif <- Power / Signif
-
-    ## Period is in years, period2 is in powers of 2
-    period2 <- log2(period)
-    ytick <- unique(trunc(period2)) # Unique integer powers of 2
-    ytickv <- 2^(ytick) # Labels are in years
-
-    ## coi is in years, coi2 in powers of 2
-    coi2 <- log2(coi)
-    coi2[coi2 < 0] <- 0
-    coi2.yy <- c(coi2, rep(max(period2, na.rm=TRUE), length(coi2)))
-    coi2.yy[is.na(coi2.yy)] <- coi[2]
-    yr.vec.xx <- c(x, rev(x))
-
-    par.orig <- par(c("mar", "las", "mfrow"))
-    on.exit(par(par.orig))
-    nlevels <- length(wavelet.levels)
-    seq.level <- seq_len(nlevels - 1)
-    key.labs <- formatC(wavelet.levels, digits = 4, format = "f")
-    asp <- NA
-    xaxs <- "i"
-    yaxs <- "i"
-    las <- 1
-    xlim <- range(x, finite=TRUE)
-    ylim <- range(period2, finite=TRUE)
-    z <- Power
-    ## invert to match std figs? Not sure how to do tht coi
-    ## parabola be easier to just fool the filled.countor internal
-    ## to change the plot order?
-    ##z <- z[,ncol(z):1]
-    ##Signif <-Signif[,ncol(Signif):1]
-    ##ytick <- rev(ytick)
-
-    if (side.by.side) {
-        ## plot set up
-        layout(matrix(c(3, 2, 1), nrow=1, byrow=TRUE),
-               widths=c(1, 1, 0.2))
-        ## plot 1: scale
-        mar <- c(3, 1, 3, 3)
-        par(mar=mar, tcl=0.5, mgp=c(1.5, 0.25, 0), las=las)
-        plot.new()
-        plot.window(ylim=c(1, nlevels), xlim=c(0, 1),
-                    xaxs=xaxs, yaxs=yaxs, asp=asp)
-        rect(0, seq.level, 1, 2:nlevels, col = key.cols)
-        axis(4, at=seq_along(wavelet.levels), labels=key.labs)
-        ## add units
-        title(key.lab, cex.main=1)
-        ## plot 2: contour-image
-        mar <- c(3, 3, 3, 3)
-        par(mar=mar, tcl=0.5, mgp=c(1.5, 0.25, 0))
-        plot.new()
-
-        plot.window(xlim, ylim, "", xaxs=xaxs, yaxs=yaxs, asp=asp, las=las)
-        # note replacement of .Internal(filledcontour(as.double(x),...)
-        # with .filled.contour() as of R-2.15.0
-        .filled.contour(as.double(x),
-                        as.double(period2),
-                        z,
-                        as.double(wavelet.levels),
-                        key.cols)
-
-        if (add.sig) {
-            contour(x, period2, Signif, levels=1, labels=siglvl,
-                    drawlabels = FALSE, axes = FALSE,
-                    frame.plot = FALSE, add = TRUE,
-                    lwd = 2, col="black")
-        }
-        if (add.coi) {
-            polygon(yr.vec.xx, coi2.yy, density=c(10, 20),
-                    angle=c(-45, 45), col="black")
-        }
-        axis(1)
-        axis(3)
-        axis(2, at = ytick, labels = ytickv)
-        axis(4, at = ytick, labels = ytickv)
-        title(xlab = x.lab, ylab = period.lab)
-        box()
-
-        ## plot 3: chron
-        mar <- c(3, 3, 3, 3)
-        par(mar = mar, las=0)
-        plot(x, y, type = "l", xlim, xaxs = xaxs, yaxs = yaxs,
-             asp = asp, xlab = "", ylab = "", axes = FALSE, col = crn.col,
-             lwd = crn.lwd, ylim = crn.ylim)
-        if (add.spline) {
-            spl <- y
-            tmp <- na.omit(spl)
-            if (is.null(nyrs)) {
-                nyrs2 <- length(tmp) * 0.33
-            } else {
-                nyrs2 <- nyrs
-            }
-            tmp <- ffcsaps(y = tmp, x = seq_along(tmp), nyrs = nyrs2, f = f)
-            spl[!is.na(spl)] <- tmp
-            lines(x, spl, col = "red", lwd = 2)
-        }
-        axis(1)
-        axis(3)
-        axis(2)
-        axis(4)
-        title(xlab = x.lab, ylab = crn.lab)
-        box()
-    }
-    else {
-        ## plot set up
-        layout(matrix(c(3, 2, 1), ncol=1, byrow=TRUE),
-               heights=c(1, 1, 0.3))
-        ## plot 1: scale
-        mar <- c(3, 3, 0.1, 3)
-        par(mar=mar, tcl=0.5, mgp=c(1.5, 0.25, 0), las=las)
-        plot.new()
-        plot.window(xlim=c(1, nlevels), ylim=c(0, 1),
-                    xaxs=xaxs, yaxs=yaxs, asp=asp)
-        rect(seq.level, 0, 2:nlevels, 1, col = key.cols)
-        axis(1, at=seq_along(wavelet.levels), labels=key.labs)
-        ## add units
-        title(sub=key.lab, cex.sub=1, line=1.5)
-        ## plot 2: contour-image
-        par(mar=mar, tcl=0.5, mgp=c(1.5, 0.25, 0))
-        plot.new()
-
-        plot.window(xlim, ylim, "", xaxs=xaxs, yaxs=yaxs, asp=asp, las=las)
-        # note replacement of .Internal(filledcontour(as.double(x),...)
-        # with .filled.contour() as of R-2.15.0
-        .filled.contour(as.double(x),
-                        as.double(period2),
-                        z,
-                        as.double(wavelet.levels),
-                        key.cols)
-
-        if (add.sig) {
-            contour(x, period2, Signif, levels=1, labels=siglvl,
-                    drawlabels = FALSE, axes = FALSE,
-                    frame.plot = FALSE, add = TRUE,
-                    lwd = 2, col="black")
-        }
-        if (add.coi) {
-            polygon(yr.vec.xx, coi2.yy, density=c(10, 20),
-                    angle=c(-45, 45), col="black")
-        }
-        axis(1)
-        axis(2, at = ytick, labels = ytickv)
-        axis(3, labels = NA)
-        axis(4, at = ytick, labels = NA)
-        title(xlab = x.lab, ylab = period.lab)
-        box()
-
-        ## plot 3: chron
-        mar <- c(0.1, 3, 3, 3)
-        par(mar = mar, las=0)
-        plot(x, y, type = "l", xlim, xaxs = xaxs, yaxs = yaxs,
-             asp = asp, xlab = "", ylab = "", axes = FALSE, col = crn.col,
-             lwd = crn.lwd, ylim = crn.ylim)
-        if (add.spline) {
-            spl <- y
-            tmp <- na.omit(spl)
-            if (is.null(nyrs)) {
-                nyrs2 <- length(tmp) * 0.33
-            } else {
-                nyrs2 <- nyrs
-            }
-            tmp <- ffcsaps(y = tmp, x = seq_along(tmp), nyrs = nyrs2, f = f)
-            spl[!is.na(spl)] <- tmp
-            lines(x, spl, col = "red", lwd = 2)
-        }
-        axis(1, labels = NA)
-        axis(2, labels = NA)
-        axis(3)
-        axis(4)
-        mtext(crn.lab, side=4, line=1.5, cex=0.75)
-        box()
-    }
-    invisible()
-}
+wavelet.plot <-
+    function(wave.list,
+             wavelet.levels = quantile(wave.list$Power, probs=seq(from=0, to=1, by=0.1)),
+             add.coi = TRUE, add.sig = TRUE, x.lab = gettext("Time"),
+             period.lab = gettext("Period"), crn.lab = gettext("RWI"),
+             key.cols = rev(rainbow(length(wavelet.levels)-1)),
+             key.lab = parse(text = paste0("\"", gettext("Power"), "\"^2")),
+             add.spline = FALSE, f = 0.5, nyrs = NULL,
+             crn.col = "black", crn.lwd = 1,coi.col='black',
+             crn.ylim = range(wave.list$y)*1.1, side.by.side = FALSE)
+{
+
+    ## Wavelet transform variables:
+    y <- wave.list$y
+    x <- wave.list$x
+    wave <- wave.list$wave
+    period <- wave.list$period
+    Signif <- wave.list$Signif
+    coi <- wave.list$coi
+    coi[coi == 0] <- 1e-12
+    Power <- wave.list$Power
+    siglvl <- wave.list$siglvl
+
+    if (any(diff(x) <= 0) || any(diff(period) <= 0)) {
+        stop("'wave.list$x' and 'wave.list$period' must be strictly ascending")
+    }
+    if (period[1] <= 0) {
+        stop("'wave.list$period' must be positive")
+    }
+
+    ## Expand signif --> (length(wave.list$Scale))x(N) array
+    Signif <- t(matrix(Signif, dim(wave)[2], dim(wave)[1]))
+    ## Where ratio > 1, power is significant
+    Signif <- Power / Signif
+
+    ## Period is in years, period2 is in powers of 2
+    period2 <- log2(period)
+    ytick <- unique(trunc(period2)) # Unique integer powers of 2
+    ytickv <- 2^(ytick) # Labels are in years
+
+    ## coi is in years, coi2 in powers of 2
+    coi2 <- log2(coi)
+    coi2[coi2 < 0] <- 0
+    coi2.yy <- c(coi2, rep(max(period2, na.rm=TRUE), length(coi2)))
+    coi2.yy[is.na(coi2.yy)] <- coi[2]
+    yr.vec.xx <- c(x, rev(x))
+
+    par.orig <- par(c("mar", "las", "mfrow"))
+    on.exit(par(par.orig))
+    nlevels <- length(wavelet.levels)
+    seq.level <- seq_len(nlevels - 1)
+    key.labs <- formatC(wavelet.levels, digits = 4, format = "f")
+    asp <- NA
+    xaxs <- "i"
+    yaxs <- "i"
+    las <- 1
+    xlim <- range(x, finite=TRUE)
+    ylim <- range(period2, finite=TRUE)
+    z <- Power
+    ## invert to match std figs? Not sure how to do tht coi
+    ## parabola be easier to just fool the filled.countor internal
+    ## to change the plot order?
+    ##z <- z[,ncol(z):1]
+    ##Signif <-Signif[,ncol(Signif):1]
+    ##ytick <- rev(ytick)
+
+    if (side.by.side) {
+        ## plot set up
+        layout(matrix(c(3, 2, 1), nrow=1, byrow=TRUE),
+               widths=c(1, 1, 0.2))
+        ## plot 1: scale
+        mar <- c(3, 1, 3, 3)
+        par(mar=mar, tcl=0.5, mgp=c(1.5, 0.25, 0), las=las)
+        plot.new()
+        plot.window(ylim=c(1, nlevels), xlim=c(0, 1),
+                    xaxs=xaxs, yaxs=yaxs, asp=asp)
+        rect(0, seq.level, 1, 2:nlevels, col = key.cols)
+        axis(4, at=seq_along(wavelet.levels), labels=key.labs)
+        ## add units
+        title(key.lab, cex.main=1)
+        ## plot 2: contour-image
+        mar <- c(3, 3, 3, 3)
+        par(mar=mar, tcl=0.5, mgp=c(1.5, 0.25, 0))
+        plot.new()
+
+        plot.window(xlim, ylim, "", xaxs=xaxs, yaxs=yaxs, asp=asp, las=las)
+        # note replacement of .Internal(filledcontour(as.double(x),...)
+        # with .filled.contour() as of R-2.15.0
+        .filled.contour(as.double(x),
+                        as.double(period2),
+                        z,
+                        as.double(wavelet.levels),
+                        key.cols)
+
+        if (add.sig) {
+            contour(x, period2, Signif, levels=1, labels=siglvl,
+                    drawlabels = FALSE, axes = FALSE,
+                    frame.plot = FALSE, add = TRUE,
+                    lwd = 2, col="black")
+        }
+        if (add.coi) {
+            polygon(yr.vec.xx, coi2.yy, density=c(10, 20),
+                    angle=c(-45, 45), col=coi.col)
+        }
+        axis(1)
+        axis(3)
+        axis(2, at = ytick, labels = ytickv)
+        axis(4, at = ytick, labels = ytickv)
+        title(xlab = x.lab, ylab = period.lab)
+        box()
+
+        ## plot 3: chron
+        mar <- c(3, 3, 3, 3)
+        par(mar = mar, las=0)
+        plot(x, y, type = "l", xlim, xaxs = xaxs, yaxs = yaxs,
+             asp = asp, xlab = "", ylab = "", axes = FALSE, col = crn.col,
+             lwd = crn.lwd, ylim = crn.ylim)
+        if (add.spline) {
+            spl <- y
+            tmp <- na.omit(spl)
+            if (is.null(nyrs)) {
+                nyrs2 <- length(tmp) * 0.33
+            } else {
+                nyrs2 <- nyrs
+            }
+            tmp <- ffcsaps(y = tmp, x = seq_along(tmp), nyrs = nyrs2, f = f)
+            spl[!is.na(spl)] <- tmp
+            lines(x, spl, col = "red", lwd = 2)
+        }
+        axis(1)
+        axis(3)
+        axis(2)
+        axis(4)
+        title(xlab = x.lab, ylab = crn.lab)
+        box()
+    }
+    else {
+        ## plot set up
+        layout(matrix(c(3, 2, 1), ncol=1, byrow=TRUE),
+               heights=c(1, 1, 0.3))
+        ## plot 1: scale
+        mar <- c(3, 3, 0.1, 3)
+        par(mar=mar, tcl=0.5, mgp=c(1.5, 0.25, 0), las=las)
+        plot.new()
+        plot.window(xlim=c(1, nlevels), ylim=c(0, 1),
+                    xaxs=xaxs, yaxs=yaxs, asp=asp)
+        rect(seq.level, 0, 2:nlevels, 1, col = key.cols)
+        axis(1, at=seq_along(wavelet.levels), labels=key.labs)
+        ## add units
+        title(sub=key.lab, cex.sub=1, line=1.5)
+        ## plot 2: contour-image
+        par(mar=mar, tcl=0.5, mgp=c(1.5, 0.25, 0))
+        plot.new()
+
+        plot.window(xlim, ylim, "", xaxs=xaxs, yaxs=yaxs, asp=asp, las=las)
+        # note replacement of .Internal(filledcontour(as.double(x),...)
+        # with .filled.contour() as of R-2.15.0
+        .filled.contour(as.double(x),
+                        as.double(period2),
+                        z,
+                        as.double(wavelet.levels),
+                        key.cols)
+
+        if (add.sig) {
+            contour(x, period2, Signif, levels=1, labels=siglvl,
+                    drawlabels = FALSE, axes = FALSE,
+                    frame.plot = FALSE, add = TRUE,
+                    lwd = 2, col="black")
+        }
+        if (add.coi) {
+            polygon(yr.vec.xx, coi2.yy, density=c(10, 20),
+                    angle=c(-45, 45), col=coi.col)
+        }
+        axis(1)
+        axis(2, at = ytick, labels = ytickv)
+        axis(3, labels = NA)
+        axis(4, at = ytick, labels = NA)
+        title(xlab = x.lab, ylab = period.lab)
+        box()
+
+        ## plot 3: chron
+        mar <- c(0.1, 3, 3, 3)
+        par(mar = mar, las=0)
+        plot(x, y, type = "l", xlim, xaxs = xaxs, yaxs = yaxs,
+             asp = asp, xlab = "", ylab = "", axes = FALSE, col = crn.col,
+             lwd = crn.lwd, ylim = crn.ylim)
+        if (add.spline) {
+            spl <- y
+            tmp <- na.omit(spl)
+            if (is.null(nyrs)) {
+                nyrs2 <- length(tmp) * 0.33
+            } else {
+                nyrs2 <- nyrs
+            }
+            tmp <- ffcsaps(y = tmp, x = seq_along(tmp), nyrs = nyrs2, f = f)
+            spl[!is.na(spl)] <- tmp
+            lines(x, spl, col = "red", lwd = 2)
+        }
+        axis(1, labels = NA)
+        axis(2, labels = NA)
+        axis(3)
+        axis(4)
+        mtext(crn.lab, side=4, line=1.5, cex=0.75)
+        box()
+    }
+    invisible()
+}

Modified: branches/redfit/man/wavelet.plot.Rd
===================================================================
--- branches/redfit/man/wavelet.plot.Rd	2013-08-27 16:32:53 UTC (rev 667)
+++ branches/redfit/man/wavelet.plot.Rd	2013-08-27 21:38:10 UTC (rev 668)
@@ -1,78 +1,78 @@
-\name{wavelet.plot}
-\alias{wavelet.plot}
-\title{ Plot a Continuous Wavelet Transform }
-\description{
-  This function creates a \code{filled.contour} plot of a continuous
-  wavelet transform as output from \code{\link{morlet}}.
-}
-\usage{
-wavelet.plot(wave.list,
-             wavelet.levels = quantile(wave.list$Power,
-                                       probs = seq(from=0, to=1, by=0.1)),
-             add.coi = TRUE, add.sig = TRUE, x.lab = gettext("Time"),
-             period.lab = gettext("Period"), crn.lab = gettext("RWI"),
-             key.cols = rev(rainbow(length(wavelet.levels)-1)),
-             key.lab = parse(text=paste0("\"", gettext("Power"), "\"^2")),
-             add.spline = FALSE, f = 0.5, nyrs = NULL,
-             crn.col = "black", crn.lwd = 1,
-             crn.ylim = range(wave.list$y)*1.1, side.by.side = FALSE)
-}
-\arguments{
-  \item{wave.list}{A \code{list}. Output from \code{\link{morlet}}.}
-  \item{wavelet.levels}{A \code{numeric} vector. Values for levels of
-    the filled contours for the wavelet plot.}
-  \item{add.coi}{A \code{logical} flag. Add cone of influence?}
-  \item{add.sig}{A \code{logical} flag. Add contour lines for significance?}
-  \item{x.lab}{X-axis label.}
-  \item{period.lab}{Y-axis label for the wavelet plot.}
-  \item{crn.lab}{Y-axis label for the time-series plot.}
-  \item{key.cols}{A vector of colors for the wavelets and the key.}
-  \item{key.lab}{Label for key.}
-  \item{add.spline}{A \code{logical} flag. Add a spline to the
-    time-series plot using \code{\link{ffcsaps}}?. }
-  \item{nyrs}{ A number giving the rigidity of the smoothing spline, defaults to
-    0.33 of series length if nyrs is \code{NULL}. }
-  \item{f}{ A number between 0 and 1 giving the frequency response or
-    wavelength cutoff for the smoothing spline. Defaults to 0.5. }
-  \item{crn.col}{Line color for the time-series plot.}
-  \item{crn.lwd}{Line width for the time-series plot.}
-  \item{crn.ylim}{Axis limits for the time-series plot.}
-  \item{side.by.side}{A \code{logical} flag. Plots will be in one row if
-    \code{TRUE}. }
-}
-\details{
-  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.
-}
-\value{
-  None. This function is invoked for its side effect, which is to produce a
-  plot.
-}
-\references{
-  Torrence, C. and Compo, G. P. (1998) A practical guide to wavelet
-  analysis.  \emph{Bulletin of the American Meteorological Society},
-  79(1):61\enc{–}{--}78.
-}
-\note{ The function \code{morlet} is a port of Torrence's
-  \acronym{IDL} code available at
-  \url{http://atoc.colorado.edu/research/wavelets/software.html}
-}
-\author{ Andy Bunn. Patched and improved by Mikko Korpela. }
-\seealso{ \code{\link{morlet}}, \code{\link{ffcsaps}}}
-\examples{data(ca533)
-ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")
-ca533.crn <- chron(ca533.rwi, prefix = "CAM", prewhiten = FALSE)
-Years <- as.numeric(rownames(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)
-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("white", "green", "blue", "red"))
-}
-\keyword{ hplot }
+\name{wavelet.plot}
+\alias{wavelet.plot}
+\title{ Plot a Continuous Wavelet Transform }
+\description{
+  This function creates a \code{filled.contour} plot of a continuous
+  wavelet transform as output from \code{\link{morlet}}.
+}
+\usage{
+wavelet.plot(wave.list,
+             wavelet.levels = quantile(wave.list$Power,
+                                       probs = seq(from=0, to=1, by=0.1)),
+             add.coi = TRUE, add.sig = TRUE, x.lab = gettext("Time"),
+             period.lab = gettext("Period"), crn.lab = gettext("RWI"),
+             key.cols = rev(rainbow(length(wavelet.levels)-1)),
+             key.lab = parse(text=paste0("\"", gettext("Power"), "\"^2")),
+             add.spline = FALSE, f = 0.5, nyrs = NULL,
+             crn.col = "black", crn.lwd = 1,coi.col='black',
+             crn.ylim = range(wave.list$y)*1.1, side.by.side = FALSE)
+}
+\arguments{
+  \item{wave.list}{A \code{list}. Output from \code{\link{morlet}}.}
+  \item{wavelet.levels}{A \code{numeric} vector. Values for levels of
+    the filled contours for the wavelet plot.}
+  \item{add.coi}{A \code{logical} flag. Add cone of influence?}
+  \item{add.sig}{A \code{logical} flag. Add contour lines for significance?}
+  \item{x.lab}{X-axis label.}
+  \item{period.lab}{Y-axis label for the wavelet plot.}
+  \item{crn.lab}{Y-axis label for the time-series plot.}
+  \item{key.cols}{A vector of colors for the wavelets and the key.}
+  \item{key.lab}{Label for key.}
+  \item{add.spline}{A \code{logical} flag. Add a spline to the
+    time-series plot using \code{\link{ffcsaps}}?. }
+  \item{nyrs}{ A number giving the rigidity of the smoothing spline, defaults to 0.33 of series length if nyrs is \code{NULL}. }
+  \item{f}{ A number between 0 and 1 giving the frequency response or
+    wavelength cutoff for the smoothing spline. Defaults to 0.5. }
+  \item{crn.col}{Line color for the time-series plot.}
+  \item{crn.lwd}{Line width for the time-series plot.}
+  \item{coi.col}{Color for the COI if \code{add.coi} is \code{TRUE}.}
+  \item{crn.ylim}{Axis limits for the time-series plot.}
+  \item{side.by.side}{A \code{logical} flag. Plots will be in one row if
+    \code{TRUE}. }
+}
+\details{
+  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.
+}
+\value{
+  None. This function is invoked for its side effect, which is to produce a
+  plot.
+}
+\references{
+  Torrence, C. and Compo, G. P. (1998) A practical guide to wavelet
+  analysis.  \emph{Bulletin of the American Meteorological Society},
+  79(1):61\enc{–}{--}78.
+}
+\note{ The function \code{morlet} is a port of Torrence's
+  \acronym{IDL} code available at
+  \url{http://atoc.colorado.edu/research/wavelets/software.html}
+}
+\author{ Andy Bunn. Patched and improved by Mikko Korpela. }
+\seealso{ \code{\link{morlet}}, \code{\link{ffcsaps}}}
+\examples{data(ca533)
+ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")
+ca533.crn <- chron(ca533.rwi, prefix = "CAM", prewhiten = FALSE)
+Years <- as.numeric(rownames(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)
+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("white", "green", "blue", "red"))
+}
+\keyword{ hplot }



More information about the Dplr-commits mailing list