gif_plot: Create a dynamic plot of fish detections

Description Usage Arguments Value Examples

View source: R/gif.R

Description

Create a dynamic plot of fish detections

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
gif_plot(
  sldf,
  detects,
  dir = "D:/Jordy/myplots/",
  extent = NA,
  type = "bing",
  darken = 2.5,
  col_by_fish = F,
  viterbi = F,
  width = 1024,
  height = 768,
  fps = fps
)

Arguments

sldf

A SpatialLineDataFrame representation of the river system. The CRS should match that of the detection data.

detects

Output of get_locations or get_best_locations

dir

The directory of the folder where the plots should be output (eg. "D:/Jordy/myplots/"). The folder should end with a "/".

extent

A vector of length four specifying the plotting extent c(x_min, x_max, y_min, y_max)

type

The background to use (see openmap) for more information.

darken

Increase to darken the background when open_maps=T. Defaults to 1.

col_by_fish

col_by_fish=T assigns each fish a unique color. This color will be preserved between mappings (i.e. between different flight periods).

viterbi

Use viterbi=T to color by survival state using the viterbi path (detects needs to be the viterbi output from hmm_survival; see examples). Expired fish will be plotted in green.

width

The width of the plot.

height

The height of the plot.

Value

Static plots that plot the fish location by flight will be added to the folder along with a gif that iterates through the flights.

Examples

1
2
3
4
# Note: Create a folder on your machine and make dir coorespond to this directory to run examples
# extent <- c(x_min=466060, x_max=1174579, y_min=6835662, y_max=7499016)
# gif_plot(sldf, viterbi, dir="S:/Jordy/telprep/telprep/gifs/viterbi/", extent=extent, viterbi=T)
# # gif_plot(sldf, best_detects, dir="S:/Jordy/telprep/telprep/gifs/byfish/", extent=extent, col_by_fish=T, viterbi=F)

jBernardADFG/telprep documentation built on July 26, 2020, 2:17 a.m.