Writes a GIF in which the trajectories from food_web_dynamics() unfold over time, one
frame per time step shown, with the panels and axes of plot.food_web(). It needs the
package gifski.
Usage
animate_food_web(
x,
file = "food_web.gif",
frames = 100,
delay = 0.08,
width = 640,
height = 640,
...
)Arguments
- x
Result of
food_web_dynamics().- file
Path of the GIF to write.
- frames
Number of frames, taken at evenly spaced rows of
x; it cannot exceed the number of rows.- delay
Seconds between frames.
- width, height
Size of the GIF in pixels.
- ...
Other arguments of
plot.food_web(), such aspanelsorcolours.
See also
Other coevolution in food webs:
food_web_dynamics(),
food_web_params(),
plot.food_web()
Examples
# \donttest{
if (requireNamespace("gifski", quietly = TRUE)) {
x <- food_web_dynamics(seq(0, 3000, by = 30), dt = 0.5)
gif <- animate_food_web(x, tempfile(fileext = ".gif"), frames = 30)
file.exists(gif)
}
#> `geom_line()`: Each group consists of only one observation.
#> ℹ Do you need to adjust the group aesthetic?
#> `geom_line()`: Each group consists of only one observation.
#> ℹ Do you need to adjust the group aesthetic?
#> `geom_line()`: Each group consists of only one observation.
#> ℹ Do you need to adjust the group aesthetic?
#> [1] TRUE
# }
