comboize_and_fortify: prepare fortified output for multipanel plot

Description Usage Arguments Examples

View source: R/combine-types.R

Description

This takes Mgen, Miso, and Mhab for a single bird and, if available, the true breeding location. Then it computes the combo-ized raster at all the requested levels of the exponents, and creates a fortified data frame of the results suitable for plotting in ggplot

Usage

1
2
3
4
5
6
7
8
comboize_and_fortify(
  mgen,
  miso,
  mhab,
  gen_beta_levels = 1,
  iso_beta_levels = c(1),
  hab_beta_levels = c(1)
)

Arguments

mgen

genetics posterior raster

miso

isotope posterior raster

mhab

habitat suitability raster

gen_beta_levels

vector of the desired values of gen_beta

iso_beta_levels

vector of the desired values of iso_beta

hab_beta_levels

vector of the desired values of hab_beta

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# run through the example for comboize to get the variables
# mgen, miso, and mhab that we will use.
example(comboize)

# then run that on the first bird to get a data frame
# that you can use with ggplot
ff <- comboize_and_fortify(mgen[[1]], miso[[1]], mhab)

# this can be plotted with ggplot2
## Not run: 
library(ggplot2)
wmap <- get_wrld_simpl()
ggplot(mapping = aes(x=long, y = lat)) +
  coord_fixed(1.3, xlim = c(-170, -50), ylim = c(33, 70)) +
  geom_polygon(data = wmap, aes(group = group), fill = NA, color = "black", size = .05) +
  geom_raster(data = ff, mapping = aes(fill = prob), interpolate = TRUE) +
  scale_fill_gradientn(colours = c("#EBEBEB", rainbow(7)), na.value = NA) +
  theme_bw() +
  facet_wrap( ~ beta_vals, ncol = 2) +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())

## End(Not run)

gaiah documentation built on July 8, 2020, 6:12 p.m.