animation_expression function

Animation Expression

Animation Expression

animation_expression( bg, bg.axes, bg.misc, bg.opts, blur.size, cliques, color_covariate_function, coord, covariate, covariate.factors, covariate.interp, covariate.legend.loc, covariate.name, covariate.range, covariate.thresh, covariate.ticks, crawl.mu.color, crawl.plot.type, cur.time, date.col, delta.t, dev.opts, dimmed, ID_names, interpolation_type, interval, legend.loc, main, method, n.frames, network, network.interp, network.ring.trans, network.ring.wt, network.segment.trans, network.thresh, network.segment.wt, par.opts, paths, paths.interp, plot.date, pt.alpha, pt.cex, pt.colors, pt.wd, res, scale, simulation, simulation.iter, tail.alpha, tail.colors, tail.length, tail.wd, theme_map, time.grid, Time.name, uncertainty.level, uncertainty.type, whole.path, xlim, ylim, ... )

Arguments

  • bg: a list object for the ggmap background if background object is supplied
  • bg.axes: logical: should animation place axis labels when using a background image (default is TRUE). If RGoogleMaps is used to produce background, labels will be "northing" and "easting". Otherwise, the strings given to coord will be used.
  • bg.misc: Character string which will be executed as R code after generating the background, and before adding trajectories, etc.
  • bg.opts: Options passed to plot() function call that makes background in each frame. For example, this could be used to specify blue ocean and gray landcover if background is a SpatialPolygonsDataFrame and bg.opts = list(bg = "dodgerblue4", col = "gray", border = "gray").
  • blur.size: a integer of the size for blur points; default is 8
  • cliques: A list of colors for network projections
  • color_covariate_function: a function to generate color for covariate interpolation
  • coord: A character vector of length 2 giving the names of the longitude/easting and latitude/northing columns in the paths data.frame (in that order). This is required if paths is not a SpatialPointsDataFrame.
  • covariate: The name of the column in paths that identifies the covariate to be mapped to a ring of color around each point.
  • covariate.factors: factor levels for covariate interpolation
  • covariate.interp: interpolation for covariate projections
  • covariate.legend.loc: either the location of the covariate legend, or NA if no legend is desired
  • covariate.name: name of covariate interpolation
  • covariate.range: the range of covariate interpolation
  • covariate.thresh: if changed from its default value of NULL, the interpolated value of the covariate will be binarized based on this numeric value.
  • covariate.ticks:
  • crawl.mu.color: color for the main predictions for crawl interpolation; default is black
  • crawl.plot.type: a character string of what type of the plot you wish to generate when interpolation_type = "crawl". Default is "point.tail" for points with tails; input "point" for point plot and input "blur" for blur point plot; input "blur.point" for blur point with tails
  • cur.time: start time of animation
  • date.col: default is "black"
  • delta.t: The gap in time between each frame in the animation. Specify one of delta.t or n.frames. If both are specified, delta.t is used.
  • dev.opts: Options passed to png() before creating each frame.
  • dimmed: Numeric vector of individuals to "dim" in the animation. Order corresponds to the order of the ID.name variable, or order of paths list.
  • ID_names: a list of names for each animal in the data
  • interpolation_type: a character string of the type of interpolation. Default is "gam" for a generalized addictive model. Input "crawl" to interpolate using crawl package
  • interval: Seconds per frame in animation. Default is 1/12 (or 12 frames per second).
  • legend.loc: passed to first argument of legend() function. Default is "topright". NA removes legend.
  • main: Title for each frame. SOON: support for changing titles to allow for, say, dates.
  • method: either "html" (default) or "mp4". The latter requires the user has installed ffmpeg (see ?animation::saveVideo()).
  • n.frames: The number of frames used to animate the complete time domain of the data.
  • network: Array of dimensions (# individuals, # individuals, n.frames) that gives a dyanmic network structure among the individuals.
  • network.interp: interpolated network of dimension (n.indiv, n.indiv, n.frames)
  • network.ring.trans: transparency of network segments (default is 1)
  • network.ring.wt: thickness of network rings (default is 3)
  • network.segment.trans:
  • network.thresh:
  • network.segment.wt: thickness of network segments (default is 3)
  • par.opts: Options passed to par() before creating each frame.
  • paths: A list of all paths from each animals stored in a data.frame or SpatialPointsDataFrame object.
  • paths.interp: a path animation object that contains all predicted and simulated paths for all animals
  • plot.date: Logical variable toggling date text at the time center of the animation.
  • pt.alpha: alpha value for the points
  • pt.cex: A numeric value giving the character expansion (size) of the points for each individual. Default is 1.
  • pt.colors: A vector of colors to be used for each individual in the animation. Default values come from Color Brewer palettes. When a network is provided, this is ignored and individuals are all colored black. If NA, no plot colors are chosen to distinguish individuals. This can be useful when making animations involving a covariate. Consider also setting legend.loc to NA in this case.
  • pt.wd: size of the points; default is 1
  • res: Resolution of images in animation. Increase this for higher quality (and larger) images.
  • scale:
  • simulation: logical. Generate simulation predictions to have multiple projects for the animal paths
  • simulation.iter: an integer of how many paths the crawl model will generate
  • tail.alpha: alpha value for the tails
  • tail.colors: default is "gray87". Can be single color or vector of colors.
  • tail.length: Length of the tail trailing each individual.
  • tail.wd: Thickness of tail trailing behind each individual. Default is 1.
  • theme_map: plot theme for ggplot, default is NULL
  • time.grid: A vector of time interval.
  • Time.name: The name of the columns in paths gving the observation times. This column must be of class POSIXt, or numeric.
  • uncertainty.level: value in (0, 1) corresponding to level at which to draw uncertainty ellipses. NA (default) results in no ellipses.
  • uncertainty.type: State what type of uncertainty plot 1 is default for tails more than 1 is amount of predicted trajectories for each unique individual and blurs for blur plot
  • whole.path: logical. If TRUE (default = FALSE), the complete interpolated trajectories will be plotted in the background of the animation. If whole.path = TRUE, consider also setting tail.length = 0.
  • xlim: Boundaries for plotting. If left undefined, the range of the data will be used.
  • ylim: Boundaries for plotting. If left undefined, the range of the data will be used.
  • ...: other arguments to be passed to ani.options to animation options such as the time interval between image frames.

Returns

animation for different methods and different interpolation types

  • Maintainer: Henry Scharf
  • License: GPL-3
  • Last published: 2025-03-02

Useful links