animateTracks: Animate the RSP tracks

View source: R/plot.R

animateTracksR Documentation

Animate the RSP tracks

Description

This function can be used to generate an animated plot of the RSP tracks.

Usage

animateTracks(
  input,
  base.raster,
  tags = NULL,
  drop.groups = NULL,
  by.group = FALSE,
  start.time,
  stop.time,
  land.col = "#BABCBF80",
  add.legend = TRUE,
  add.stations = FALSE,
  save.gif = FALSE,
  gif.name = "Animation.gif",
  height = 720,
  width = 720,
  xlim = NULL,
  ylim = NULL,
  nframes = 100,
  fps = 10
)

Arguments

input

The output of runRSP.

base.raster

The raster used to generate the transition layer used in runRSP.

tags

Character vector specifying which tags to include in the animation.

drop.groups

Character vector specifying any group(s) to the be removed from the animation.

by.group

Logical, if TRUE one facet will be plotted for each tracked group. Defauly is FALSE.

start.time

Character vector of the start point (format = "Y-m-d H:M:S") for the animation.

stop.time

Character vector of the stop point (format = "Y-m-d H:M:S") for the animation.

land.col

Colour of the land masses. Defaults to semi-transparent grey.

add.legend

Logical, if TRUE (default) a colour legend representing the monitored tags will be included.

add.stations

Logical, if TRUE the stations will be added to the animaltion. Default is FALSE. Only works if by.group = FALSE.

save.gif

Logical defining if the animation should be saved.

gif.name

If save.gif = TRUE, character vector for the GIF name.

height

If save.gif = TRUE, number of pixels for the GIF height.

width

If save.gif = TRUE, number of pixels for the GIF width.

xlim

Numeric vector defining the horizontal limits of the map.

ylim

Numeric vector defining the vertical limits of the map.

nframes

The number of frames to render (default 100).

fps

The framerate of the animation in frames/sec (default 10).

Value

An animation of the RSP tracks.

Examples


# Import river shapefile
water <- actel::shapeToRaster(shape = paste0(system.file(package = "RSP"), "/River_latlon.shp"), 
size = 0.0001, buffer = 0.05) 

# Create a transition layer with 8 directions
tl <- actel::transitionLayer(x = water, directions = 8)

# Import example output from actel::explore() 
data(input.example) 

# Run RSP analysis
rsp.data <- runRSP(input = input.example, t.layer = tl, coord.x = "Longitude", coord.y = "Latitude")

# Animate and RSP track:
animateTracks(input = rsp.data, base.raster = water, tags = "A69-9001-1111", add.stations = TRUE)



YuriNiella/RSP documentation built on Feb. 2, 2024, 5:03 a.m.