plot_mask: Plot a gibbonsecr mask

Description Usage Arguments Author(s) See Also Examples

Description

Plotting functions for gibbonsecr mask objects. The plot method is a wrapper for plot.mask and geom_mask is a wrapper for geom_point (or geom_contour when contour = TRUE)

Usage

1
2
3
4
## S3 method for class 'gmask'
plot(x, covariate = NULL, sessions = NULL, ...)

geom_mask(x, covariate = NULL, sessions = NULL, contour = FALSE, ...)

Arguments

x

a gmask object

covariate

name of covariate to use for colouring

sessions

sessions to plot (as integer indices, logical indices or session names)

...

additional arguments to pass to plot.mask or geom_point

contour

if TRUE, contour lines will be plotted

Author(s)

Darren Kidney darrenkidney@googlemail.com

See Also

plot.gcapthist

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
## Not run: 

data(N.annamensis)
mask = N.annamensis.mask
capthist = N.annamensis.capthist

# plot methods -----------------------------------------------------------------

par(mar = c(2,2,1,1))

plot(mask)
points(capthist, cex = 0.5)

plot(mask, covariate = "x", legend = FALSE)
points(capthist, cex = 0.5)

plot(mask, covariate = "y", legend = FALSE)
points(capthist, cex = 0.5)

plot(mask, covariate = "habitat", legend = FALSE)
points(capthist, cex = 0.5)

# ggplot methods ---------------------------------------------------------------

library(ggplot2)

ggplot() + coord_fixed() +
    geom_mask(mask) +
    geom_capthist(capthist) +
    labs(x = "Longitude", y = "Latitude")

ggplot() + coord_fixed() +
    geom_mask(mask, covariate = "x") +
    geom_capthist(capthist) +
    scale_fill_distiller(palette = "Spectral") +
    labs(x = "Longitude", y = "Latitude", fill = "Longitude")

ggplot() + coord_fixed() +
    geom_mask(mask, covariate = "y") +
    geom_capthist(capthist) +
    scale_fill_distiller(palette = "Spectral") +
    labs(x = "Longitude", y = "Latitude", fill = "Latitutde")

ggplot() + coord_fixed() +
    geom_mask(mask, covariate = "habitat") +
    geom_capthist(capthist) +
    scale_fill_manual(values = c("darkgreen", "lightgreen")) +
    labs(x = "Longitude", y = "Latitude", fill = "habitat")

## End(Not run)

dkidney/gibbonsecr documentation built on May 15, 2019, 9:11 a.m.