plot.biwavelet: Plot 'biwavelet' objects

Description Usage Arguments Details Author(s) References See Also Examples

Description

Plot biwavelet objects such as the cwt, cross-wavelet and wavelet coherence

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## S3 method for class 'biwavelet'
 plot(x, ncol = 64, xlab = "Time", ylab = "Period",
               tol = 0.95, plot.cb = FALSE, plot.phase = FALSE, 
               type=c("power.corr.norm", "power.corr", "power.norm", "power", 
               "wavelet", "phase"), 
               plot.coi = TRUE, lwd.coi=4, col.coi="white", lty.coi=2,
               plot.sig = TRUE, lwd.sig=4, col.sig="black", lty.sig=1,
               bw = FALSE, legend.loc = NULL, legend.horiz = FALSE, 
               arrow.size = 0.08, arrow.size.head = 0.05, arrow.lwd = 2, 
               arrow.cutoff = 0.9, arrow.col="black",
               arrow.nlocs.x = round(length(x$period)/2), 
               arrow.nlocs.y = round(NCOL(x$wave)/2),
               xlim = NULL, ylim = NULL, xaxt = "s", yaxt = "s", 
               form='%Y', ...)

Arguments

x

biwavelet object generated by wt, xwt, or wtc.

ncol

number of colors to use. Default is 64.

xlab

xlabel of the figure. Default is "Time"

ylab

ylabel of the figure. Default is "Period"

tol

tolerance level for significance contours. Sigificance contours will be drawn around all regions of the spectrum where spectrum/percentile >= tol. Default is 0.95. If strict i^{th} percentile regions are desired, then set tol=1.

plot.cb

plot color bar if TRUE. Default is FALSE.

plot.phase

Plot phases with black arrows. Default is FALSE.

type

type of plot to create. Can be power to plot the power, power.corr to plot the bias-corrected power, power.norm to plot the power normalized by the variance, power.corr.norm to plot the bias-corrected power normalized by the variance, wavelet to plot thewavelet coefficients, or phase to plot the phase. Default is power.corr.norm.

plot.coi

plot cone of influence (COI) if TRUE. Default is TRUE. Areas that fall outside of the COI can be affected by edge effects.

lwd.coi

Line width of COI. Default is 4.

col.coi

Color of cone of COI. Default is white.

lty.coi

Line type of COI

plot.sig

plot contours for significance if TRUE. Default is TRUE.

lwd.sig

Line width of significance contours. Default is 4.

col.sig

Color of significance contours. Default is black.

lty.sig

Line type of significance contours. Default is 1.

bw

plot in black and white if TRUE. Default is FALSE.

legend.loc

legend location coordinates as defined by image.plot. Default is NULL.

legend.horiz

plot a horizontal legend if TRUE. Default is FALSE.

arrow.size

size of the arrows. Default is 0.08.

arrow.size.head

size of the arrow head. Default is 0.05.

arrow.lwd

width/thickness of arrows. Default is 2.

arrow.cutoff

cutoff value for plotting arrows. z-values that fall below the arrow.cutoff quantile will not be plotted. Default is 0.9.

arrow.col

Color of arrows. Default is black.

arrow.nlocs.x

Integer number of x- or time-locations where phase arrows should be plotted. Default is 1/2 of the time-locations

arrow.nlocs.y

Integer number of y- or period-locations where phase arrows should be plotted. Default is 1/2 of the period-locations

xlim

the x limits. The default is NULL.

ylim

the y limits. The default is NULL.

xaxt

Add x-axis? The default is s; use n for none.

yaxt

Add y-axis? The default is s; use n for none.

form

format to use to display dates on the x-axis. Default is '%Y' for 4-digit year. See ?Date for other valid formats.

...

other parameters.

Details

Arrows pointing to the right mean that x and y are in phase.

Arrows pointing to the left mean that x and y are in anti-phase.

Arrows pointing up mean that y leads x by π/2.

Arrows pointing down mean that x leads y by π/2.

Author(s)

Tarik C. Gouhier (tarik.gouhier@gmail.com)

Code based on WTC MATLAB package written by Aslak Grinsted.

References

Cazelles, B., M. Chavez, D. Berteaux, F. Menard, J. O. Vik, S. Jenouvrier, and N. C. Stenseth. 2008. Wavelet analysis of ecological time series. Oecologia 156:287-304.

Grinsted, A., J. C. Moore, and S. Jevrejeva. 2004. Application of the cross wavelet transform and wavelet coherence to geophysical time series. Nonlinear Processes in Geophysics 11:561-566.

Torrence, C., and G. P. Compo. 1998. A Practical Guide to Wavelet Analysis. Bulletin of the American Meteorological Society 79:61-78.

Liu, Y., X. San Liang, and R. H. Weisberg. 2007. Rectification of the Bias in the Wavelet Power Spectrum. Journal of Atmospheric and Oceanic Technology 24:2093-2102.

See Also

image.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
t1=cbind(1:100, rnorm(100))
t2=cbind(1:100, rnorm(100))
## Continuous wavelet transform
wt.t1=wt(t1)
## Plot power
## Make room to the right for the color bar
par(oma=c(0, 0, 0, 1), mar=c(5, 4, 4, 5) + 0.1)
plot(wt.t1, plot.cb=TRUE, plot.phase=FALSE)

## Cross-wavelet transform
xwt.t1t2=xwt(t1, t2)
## Plot cross-wavelet
par(oma=c(0, 0, 0, 1), mar=c(5, 4, 4, 5) + 0.1)
plot(xwt.t1t2, plot.cb=TRUE)

## Example of bias-correction
t1=sin(seq(from=0, to=2*5*pi, length=1000))
t2=sin(seq(from=0, to=2*15*pi, length=1000))
t3=sin(seq(from=0, to=2*40*pi, length=1000))
## This aggregate time series should have the same power at three distinct periods
s=t1+t2+t3
## Compare plots to see bias-effect on CWT: biased power spectrum artificially
## reduces the power of higher-frequency fluctuations.
wt1=wt(cbind(1:1000, s))
par(mfrow=c(1,2))
plot(wt1, type="power.corr.norm", main="Bias-corrected")
plot(wt1, type="power.norm", main="Biased")

## Compare plots to see bias-effect on XWT: biased power spectrum artificially
## reduces the power of higher-frequency fluctuations.
x1=xwt(cbind(1:1000, s), cbind(1:1000, s))
par(mfrow=c(1,2))
plot(x1, type="power.corr.norm", main="Bias-corrected")
plot(x1, type="power.norm", main="Biased")

Example output

biwavelet 0.20.11 loaded.

biwavelet documentation built on May 2, 2019, 5:10 p.m.