Usage
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)
Arguments
dat
A SpatialPointsDataFrame
object returned by
mp2xy
. habitat
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).
outfile
A character string giving the desired output path and
filename.
zlim
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).
axes
Logical. Should axes be drawn?
pt.col
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. pt.cex
Point size magnifier, relative to the default.
height
Numeric. The height of the animation, in pixels. Default is
800.
width
Numeric. The width of the animation, in pixels. Default is 800.
interval
The time interval of the animation, in seconds. Default is
0.05, i.e. 20 frames per second.
label
Should a time step counter be plotted?
label.pos
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
.
label.just
Justification of the time step counter label, relative to
label.pos
. See the description of just
at
grid.text
. Ignored if label
is FALSE
. label.cex
Size of the time step counter text. Ignored if label
is FALSE
.
label.font
Font face of the time step counter text. See
fontface
at gpar
for available options. Ignored if
label
is FALSE
. overwrite
Should outfile
be overwritten if it already exists?