plotmag: For plotting the magnitude of values in 'tts', 'coh' and...

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

View source: R/plotmag.R

Description

For plotting the magnitude of values in tts objects (and derived classes) against time and timescale, and coh and wlmtest objects against timescale

Usage

 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
plotmag(object, ...)

## S3 method for class 'tts'
plotmag(
  object,
  zlims = NULL,
  neat = TRUE,
  colorfill = NULL,
  colorbar = TRUE,
  title = NULL,
  filename = NA,
  ...
)

## S3 method for class 'wt'
plotmag(
  object,
  zlims = NULL,
  neat = TRUE,
  colorfill = NULL,
  colorbar = TRUE,
  title = NULL,
  filename = NA,
  ...
)

## S3 method for class 'wmf'
plotmag(
  object,
  zlims = NULL,
  neat = TRUE,
  colorfill = NULL,
  colorbar = TRUE,
  title = NULL,
  filename = NA,
  ...
)

## S3 method for class 'wpmf'
plotmag(
  object,
  zlims = NULL,
  neat = TRUE,
  colorfill = NULL,
  sigthresh = 0.95,
  colorbar = TRUE,
  title = NULL,
  filename = NA,
  ...
)

## S3 method for class 'coh'
plotmag(
  object,
  sigthresh = c(0.95, 0.99),
  bandprows = "all",
  filename = NA,
  ...
)

## S3 method for class 'wlmtest'
plotmag(
  object,
  sigthresh = c(0.95, 0.99),
  bandprows = "all",
  filename = NA,
  ...
)

## Default S3 method:
plotmag(object, ...)

Arguments

object

An object of class tts or some class that inherits from tts or of class coh or wlmtest

...

Additional graphics parameters passed to image (graphics package) if colorbar==FALSE, or to image.plot (fields package) if colorbar==TRUE (for tts objects)

zlims

z axis limits. If specified, must encompass the range of Mod(get_values(object)). Default NULL uses this range.

neat

Logical. Should timescales with no values be trimmed?

colorfill

Color spectrum to use, set through colorRampPalette. Default value NULL produces jet colors from Matlab.

colorbar

Logical. Should a colorbar legend be plotted?

title

Title for the top of the plot.

filename

Filename (without extension), for saving as pdf. Default value NA saves no file and uses the default graphics device.

sigthresh

Significance threshold(s). Numeric vector with values between 0 and 1. Typically 0.95, 0.99, 0.999, etc. For wpmf objects, contours are plotted at these values; for coh and wlmtest objects the threshholds are plotted on coherence plots.

bandprows

The rows of object$bandp for which to display results in coh plots

Details

For coh (respectively, wlmtest) objects, the modulus of object$coher (respectively, object$wlmobj$coher) is plotted using a solid red line, and the modulus of object$signif$coher is plotted using a dashed red line. The two coherences agree except for sigmethod="fast", for which they are close. The dashed line is what should be compared to the distribution of surrogate coherences (black lines, which only appear for coh objects if signif is not NA). Horizontal axis ticks are labeled as timescales, but are spaced on the axis as log(1/timescale), i.e., log frequencies.

Author(s)

Thomas Anderson, anderstl@gmail.com, Jon Walter, jaw3es@virginia.edu; Lawrence Sheppard, lwsheppard@ku.edu; Daniel Reuman, reuman@ku.edu

References

Sheppard, L.W., et al. (2016) Changes in large-scale climate alter spatial synchrony of aphid pests. Nature Climate Change. DOI: 10.1038/nclimate2881

Sheppard, LW et al. (2019) Synchrony is more than its top-down and climatic parts: interacting Moran effects on phytoplankton in British seas. Plos Computational Biology 15, e1006744. doi: 10.1371/journal.pcbi.1006744

See Also

tts, wt, wmf, wpmf, coh, wlmtest, plotphase, bandtest, plotrank, browseVignettes("wsyn")

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
35
36
#For a wt object
time1<-1:100
time2<-101:200
ts1p1<-sin(2*pi*time1/15)
ts1p2<-0*time1
ts2p1<-0*time2
ts2p2<-sin(2*pi*time2/8)
ts1<-ts1p1+ts1p2
ts2<-ts2p1+ts2p2
ts<-c(ts1,ts2)
ra<-rnorm(200,mean=0,sd=0.5)
t.series<-ts+ra
t.series<-t.series-mean(t.series)
times<-c(time1,time2)
res<-wt(t.series, times)
plotmag(res)

#For a wmf object
x1<-0:50
x2<-51:100
x<-c(x1,x2)
ts1<-c(sin(2*pi*x1/10),sin(2*pi*x2/5))+1.1
dat<-matrix(NA,11,length(x))
for (counter in 1:dim(dat)[1])
{
  ts2<-3*sin(2*pi*x/3+2*pi*runif(1))+3.1
  ts3<-rnorm(length(x),0,1.5)
  dat[counter,]<-ts1+ts2+ts3    
  dat[counter,]<-dat[counter,]-mean(dat[counter,])
}
times<-x
res<-wmf(dat,times)
plotmag(res)

#similar calls for wpmf, coh, wlm, wlmtest objects
#see documentation 

wsyn documentation built on June 19, 2021, 1:07 a.m.