plot.simmr_input: Plot the 'simmr_input' data created from 'simmr_load'

Description Usage Arguments Details Author(s) See Also Examples

View source: R/plot.simmr_input.R

Description

This function creates iso-space (AKA tracer-space or delta-space) plots. They are vital in determining whether the data are suitable for running in a SIMM.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## S3 method for class 'simmr_input'
plot(
  x,
  tracers = c(1, 2),
  title = "Tracers plot",
  xlab = colnames(x$mixtures)[tracers[1]],
  ylab = colnames(x$mixtures)[tracers[2]],
  sigmas = 1,
  group = 1:x$n_groups,
  mix_name = "Mixtures",
  ggargs = NULL,
  colour = TRUE,
  ...
)

Arguments

x

An object created via the function simmr_load

tracers

The choice of tracers to plot. If there are more than two tracers, it is recommended to plot every pair of tracers to determine whether the mixtures lie in the mixing polygon defined by the sources

title

A title for the graph

xlab

The x-axis label. By default this is assumed to be delta-13C but can be made richer if required. See examples below.

ylab

The y-axis label. By default this is assumed to be delta-15N in per mil but can be changed as with the x-axis label

sigmas

The number of standard deviations to plot on the source values. Defaults to 1.

group

Which groups to plot. Can be a single group or multiple groups

mix_name

A optional string containing the name of the mixture objects, e.g. Geese.

ggargs

Extra arguments to be included in the ggplot (e.g. axis limits)

colour

If TRUE (default) creates a plot. If not, puts the plot in black and white

...

Not used

Details

It is desirable to have the vast majority of the mixture observations to be inside the convex hull defined by the food sources. When there are more than two tracers (as in one of the examples below) it is recommended to plot all the different pairs of the food sources. See the vignette for further details of richer plots.

Author(s)

Andrew Parnell <andrew.parnell@mu.ie>

See Also

See plot.simmr_output for plotting the output of a simmr run. See simmr_mcmc for running a simmr object once the iso-space is deemed acceptable.

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
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
# A simple example with 10 observations, 4 food sources and 2 tracers
data(geese_data_day1)
simmr_1 <- with(
  geese_data_day1,
  simmr_load(
    mixtures = mixtures,
    source_names = source_names,
    source_means = source_means,
    source_sds = source_sds,
    correction_means = correction_means,
    correction_sds = correction_sds,
    concentration_means = concentration_means
  )
)

# Plot
plot(simmr_1)

### A more complicated example with 30 obs, 3 tracers and 4 sources
data(simmr_data_2)
simmr_3 <- with(
  simmr_data_2,
  simmr_load(
    mixtures = mixtures,
    source_names = source_names,
    source_means = source_means,
    source_sds = source_sds,
    correction_means = correction_means,
    correction_sds = correction_sds,
    concentration_means = concentration_means
  )
)

# Plot 3 times - first default d13C vs d15N
plot(simmr_3)
# Now plot d15N vs d34S
plot(simmr_3, tracers = c(2, 3))
# and finally d13C vs d34S
plot(simmr_3, tracers = c(1, 3))
# See vignette('simmr') for fancier x-axis labels

# An example with multiple groups - the Geese data from Inger et al 2006
data(geese_data)
simmr_4 <- with(
  geese_data,
  simmr_load(
    mixtures = mixtures,
    source_names = source_names,
    source_means = source_means,
    source_sds = source_sds,
    correction_means = correction_means,
    correction_sds = correction_sds,
    concentration_means = concentration_means,
    group = groups
  )
)

# Print
simmr_4

# Plot
plot(simmr_4,
  xlab = expression(paste(delta^13, "C (\u2030)", sep = "")),
  ylab = expression(paste(delta^15, "N (\u2030)", sep = "")),
  title = "Isospace plot of Inger et al Geese data"
) #'

simmr documentation built on Feb. 27, 2021, 5:05 p.m.