Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/plot_bioenergmod.R
Plot temporal variation in parameters or model outputs by land cover type
1 2 3 |
x |
One of the list elements resulting from |
ylab |
Y axis label |
scale |
Value by which to divide the results, for scaling |
xaxislab |
Defaults to |
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 |
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.
Prints the plot and returns a ggplot2 object
Kristen Dybala, kdybala@pointblue.org
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.
run_bioenergmod_loop
, bioenergmod.mc
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.