cnltspec.plot: A function to plot CNLT spectral quantities of interest

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

Description

The function takes a spectral quantity and plots it according to user inputted graphical options

Usage

1
2
3
cnltspec.plot(spec, timevec, scalevec, zrange = NULL, xtitle = "Time", ytitle = "Scale", 
col.scale = tim.colors(64)[1:45], SFratio = 2, dt = 1, parsw = 3, axis4 = FALSE, 
frequencies = NULL)

Arguments

spec

A spectral quantity, i.e. contained in a cnlt.spec object. For example, this could be the coherence between components of a bivariate series.

timevec

A vector corresponding to the x-axis of the spectral object, often time or a sampling grid.

scalevec

A vector of scales corresponding to the y-axis of the spectral object.

zrange

An optional length two vector specifying the range of the z-axis of the plot.

xtitle

A label for the x-axis of the plot.

ytitle

A label for the y-axis of the plot.

col.scale

a color palette to use for the spectral plot.

SFratio

A number specifying the relationship between scale and Fourier frequency, see frequencies argument, and Sanderson (2010), chapter 6.2.

dt

A sampling interval, used to compute the relationship between scale and Fourier frequency, see Sanderson (2010), chapter 6.2.

parsw

A number from 1 to 3, specifying different spacings between the plot and the legend. This is useful if you want to do call cnltspec.plot multiple times for e.g. multi-panel plots.

axis4

An optional boolean variable indicating whether a 4th (right) axis should be added to the plot.

frequencies

If axis4 = TRUE, an optional vector for the ticks on the 4th axis. If these are not specified, then a vector of Fourier frequencies are plotted, with the relationship between scale and frequency specified by SFratio, see Sanderson (2010), chapter 6.2.

Value

A spectral quantity is plotted.

Author(s)

Jean Hamilton, Matt Nunes

References

Hamilton, J., Nunes, M. A., Knight, M. I. and Fryzlewicz, P. (2018) Complex-valued wavelet lifting and applications. Technometrics, 60 (1), 48-60, DOI 10.1080/00401706.2017.1281846.

Sanderson, J. (2010) Wavelet methods for time series with bivariate observations and irregular sampling grids. PhD Thesis, University of Bristol, UK.

See Also

cnlt.spec

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# simulate data, e.g. two sinusoids
dat <- seq(from=1, to=3, by=0.1)
x1 <- cumsum(sample(dat, 200, TRUE)) 

y1 <-sin(2*pi*(1/25)*x1) + sin(2*pi*(1/50)*x1)+ 1*sin(2*pi*(1/10)*x1)+ rnorm(length(x1), 0,0.2)
y3 <- c(sin(2*pi*(1/25)*x1[1:100]),sin(2*pi*(1/25)*x1[97:196]))+ rnorm(length(x1), 0,0.1)

## Not run: 

y1y3.dec<-cnlt.biv(x1, f1=y1, f2=y3, P = 500)

y1y3spec<-cnlt.spec(y1y3.dec)

cnltspec.plot(y1y3spec$coh,y1y3spec$mtime,y1y3spec$mscale)

## End(Not run)

nunesmatt/CNLTtsa documentation built on May 6, 2019, 8:58 p.m.