mp_animate: Animate the output of a RAMAS Metapop simulation.

Description Usage Arguments Details Value See Also

View source: R/mp_animate.R


Animate temporal habitat and abundance dynamics on a gridded landscape.


mp_animate(dat, habitat, outfile, zlim, axes = FALSE, col.regions = NULL,
  pt.col = NULL, pt.cex = 1, height = 800, width = 800,
  interval = 0.05, label = TRUE, label.pos = c(0.98, 0.05),
  label.just = "right", label.cex = 1.5, label.font = 2,
  overwrite = FALSE)



A SpatialPointsDataFrame object returned by mp2xy.


A RasterStack or RasterBrick object. The number of Raster layers should equal the number of simulation time steps. Further, the layers should be ordered temporally, and should correspond to the levels of dat$time. It is assumed that the time step between layers is consistent (i.e., the interval between animation frames is constant).


A character string giving the desired output path and filename.


A numeric vector of length 2 giving the lower and upper limits of the color scale indicating habitat quality. If this is not provided, a pretty range will be calculated (though this will impact efficiency).


Logical. Should axes be drawn?


A colorRampPalette function that will be used to generate the colour ramp for grids. If NULL, a default colour ramp based on terrain.colors is used.


A colorRampPalette function that will be used to generate the colour ramp for points. These colours will be interpolated into 100 colours, which indicate relative mean population size, ranging from 1 (first element of the colour ramp) to the maximum mean population size that exists in the simulation output. If NULL, a default colour ramp ranging from white to black is used.


Point size magnifier, relative to the default.


Numeric. The height of the animation, in pixels. Default is 800.


Numeric. The width of the animation, in pixels. Default is 800.


The time interval of the animation, in seconds. Default is 0.05, i.e. 20 frames per second.


Should a time step counter be plotted?


A vector of two numbers giving the normalised parent coordinates at which the time step counter will be plotted. The first number gives the x-coordinate (0 = left edge, 1 = right edge) and the second gives the y-coordinate (0 = bottom edge, 1 = top edge). The default value of c(0.98, 0.05) plots the label at the bottom right corner. Ignored if label is FALSE.


Justification of the time step counter label, relative to label.pos. See the description of just at grid.text. Ignored if label is FALSE.


Size of the time step counter text. Ignored if label is FALSE.


Font face of the time step counter text. See fontface at gpar for available options. Ignored if label is FALSE.


Should outfile be overwritten if it already exists?


mp_animate requires that either or are installed on the system. See the documentation for animation::im.convert for further details.

An animated gif is created, with points indicating the location of populations with mean abundance greater than zero, overlaid upon a raster grid indicating habitat suitability. Relative population size is represented by point colour, with white corresponding to a population with mean abundance between 0 and 1 populations and time steps, and black corresponding to the maximum mean abundance. Colours for intermediate values are scaled linearly. The colour key indicates carrying capacity, and corresponds to the colour of grid cells.

An example of this function's use is provided in the vignette "Introduction to mptools" (vignette('intro', 'mptools')).


NULL. The animation is saved as an animated .gif file at the specified path (outfile).

See Also


mptools documentation built on May 2, 2019, 6:54 a.m.