plot_bioenergmod: Plot bioenergetics model results

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

View source: R/plot_bioenergmod.R

Description

Plot temporal variation in parameters or model outputs by land cover type

Usage

1
2
3
plot_bioenergmod(x, ylab, scale = 1, xaxislab = TRUE, xmax = NULL,
  ymax = NULL, der = NULL, palette = NULL, levels = NULL,
  labels = NULL)

Arguments

x

One of the list elements resulting from run_bioenergmod_loop

ylab

Y axis label

scale

Value by which to divide the results, for scaling

xaxislab

Defaults to TRUE; if FALSE, do not show x axis labels; useful for multi-panel plots

xmax

Optional value to over-ride automatic x-axis range

ymax

Optional value to over-ride automatic y-axis range

der

Optionally provide daily energy requirements to plot a line on top of model results for comparison

palette

Optionally provide a set of colors to over-ride the defaults

levels

Optionally provide a list of factor levels to control the order in which they're stacked

labels

Optionally provide a list of labels to replace defaults

Details

Convenience plotting function for plotting the contribution of each land cover type to habitat availability or energy supply over all time steps as a stacked area plot. Can be used directly with the results from calculate_habitat_change or run_bioenergmod_loop, or with any data frame with time steps in rows and types in columns. To use this plot with the results of bioenergmod.mc, first summarize across all iterations of the Monte Carlo simulation (see examples).

Note: This function is customized with parameters specific to the Central Valley Joint Venture non-breeding shorebirds project (Dybala et al. 2016), such as the land cover type and time step labels. Edit function for other applications.

Value

Prints the plot and returns a ggplot2 object

Author(s)

Kristen Dybala, kdybala@pointblue.org

References

Dybala KE, Reiter ME, Hickey CM, Shuford WD, Strum KM, and Yarris GS. 2016. A bioenergetics modeling approach to setting conservation objectives for non-breeding shorebirds in California's Central Valley wetlands and flooded agriculture.

See Also

run_bioenergmod_loop, bioenergmod.mc

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
energyneed = calculate_energy_demand(n=c(100,150,200), bodymass=c(0.1,0.08,0.05),
   metabolism='FMR', assimilation=0.73)
energydens = data.frame(habitat=c('A','B','C'), value=c(5,10,15))
tot = data.frame(habitat=c('A','B','C'), area=c(10000,4000,6000))
flood = data.frame(habitat=c(rep('A',3),rep('B',3),rep('C',3)), yday=rep(c(1:3),3),
   value=c(0.9,0.8,0.7, 0.1,0.15,0.2, 0.5,0.5,0.5))
depth = data.frame(habitat=c(rep('A',3),rep('B',3),rep('C',3)), yday=rep(c(1:3),3),
   value=rep(0.9,9))
change = calculate_habitat_change(tothabitat=tot, flood=flood, time='yday',
   value='value', accessible=depth, wetsplit=FALSE)
results = run_bioenergmod_loop(energyneed=energyneed, energydens=energydens,
   habitat.available=change$openwater, habitat.accessible=change$accessible,
   habitat.added=change$added, habitat.returned=change$returned,
   prop.accessible=change$prop.accessible)
plot_bioenergmod(results$energy.accessible, scale=1, ylab='kJ', der=energyneed)

## Not run: 
## To work with the results of bioenergmod.mc, first summarize across all
## iterations of the Monte Carlo simulation:
results = bioenergmod.mc()
a = as.data.frame(apply(results$energy.accessible[,2:6,], MARGIN=c(1,2), median))
plot_bioenergmod(a, ylab='kJ (billions)', scale=1000000000, der=energyneed)

## End(Not run)

kdybala/bioenergmod documentation built on May 20, 2019, 8:28 a.m.