# load libraries library(data.table) library(ggplot2) library(patchwork) library(colorspace) # load local packages devtools::load_all()
# load data, split by simulation and regrowth data_land <- fread("data/results/data_landscape_progression.csv") data_land <- data_land[gen %in% c(1, 10, 50, 950) & regrowth %in% c(0.001, 0.005, 0.02, 0.05), ] data_land = split(data_land, by = c("sim_type")) data_land = lapply(data_land, function(df) { split(df, by = "regrowth") })
# function from plots plot_subplots = function(df) { ggplot(df)+ geom_tile( aes(x, y, fill = items) )+ scale_fill_continuous_sequential( palette = "Batlow", l1 = 20, l2 = 100, c1 = 10, begin = 0.2, limits = c(1, NA), labels = function(x) as.integer(x), na.value = "white", name = "# Prey", rev = T, guide = guide_legend(order = 1) )+ facet_grid( ~ gen, labeller = labeller( gen = function(x) sprintf("G = %s", x) ) )+ coord_equal(expand = F) + kleptomoveMS::theme_custom( landscape = T, base_size = 10 ) + theme(legend.position = "right", legend.key.width = unit(2, units = "mm"), legend.key.height = unit(1, units = "mm"), plot.title = ggtext::element_markdown(), # legend.text = element_text(size = 6), # legend.title = element_text(size = 6) ) + labs( fill = "# Prey", size = "# Indiv.", title = sprintf("r<sub>max</max>: %s", unique(df$regrowth)) ) }
# wrap all plots plots = lapply(data_land, function(l) { subplots = lapply(l, plot_subplots) wrap_plots(subplots, ncol = 2) & plot_annotation( tag_levels = "A" ) & theme( legend.position = "bottom", plot.tag = element_text(face = "bold") ) })
```r$ (A, B). However, at $r_{max} >$ 0.01 (C, D), prey item regeneration exceeds depletion and the resource landscape is rapidly saturated until most cells carry 5 items, the maximum allowed in our model.", eval=TRUE} plots[["foragers"]]
```r$ (A): 1 prey item generated per 1,000 timesteps, or 2.5 generations. At all $r_{max} \\geq$ 0.05 (B, C, D), prey item regeneration matches or exceeds depletion and the resource landscape either shows strong spatial structure, or is entirely saturated with prey items.", eval=TRUE} plots[["obligate"]]
r$ (A, B), where foragers completely deplete the resource landscape). Similarly, at $r_{max} >$ 0.01 (C, D), prey item regeneration exceeds depletion and the resource landscape is rapidly saturated to a carrying capacity of 5 prey items per cell.", eval=TRUE}
plots[["facultative"]]
\newpage
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.