plotSat: Plot observations on satellite image

Description Usage Arguments Details References

View source: R/plotSat.R

Description

Plot tracking data on a satellite map. This function plots coordinates in longitude and latitude (not UTM), so if data coordinates are not provided in longitude and latitude, then the coordinate reference system must be provided using the projargs argument. This function uses the package ggmap to fetch a satellite image from Google. An Internet connection is required to use this function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
plotSat(
  data,
  zoom = NULL,
  location = NULL,
  segments = TRUE,
  compact = TRUE,
  col = NULL,
  alpha = 1,
  size = 1,
  shape = 16,
  states = NULL,
  animals = NULL,
  ask = TRUE,
  return = FALSE,
  stateNames = NULL,
  projargs = NULL
)

Arguments

data

Data frame or momentuHMMData object, with necessary fields 'x' (longitudinal direction) and 'y' (latitudinal direction). A momentuHMM, miHMM, or miSum object is also permitted, from which the data will be extracted. If states=NULL and a momentuHMM, miHMM, or miSum object is provided, the decoded states are automatically plotted.

zoom

The zoom level, as defined for get_map. Integer value between 3 (continent) and 21 (building).

location

Location of the center of the map to be plotted (this must be in the same coordinate reference system as data).

segments

TRUE if segments should be plotted between the observations (default), FALSE otherwise.

compact

FALSE if tracks should be plotted separately, TRUE otherwise (default).

col

Palette of colours to use for the dots and segments. If not specified, uses default palette.

alpha

Transparency argument for geom_point.

size

Size argument for geom_point.

shape

Shape argument for geom_point. If states is provided, then shape must either be a scalar or a vector of length length(unique(states)). If states=NULL, then shape must either be a scalar or a vector consisting of a value for each individual to be plotted.

states

A sequence of integers, corresponding to the decoded states for these data (such that the observations are colored by states).

animals

Vector of indices or IDs of animals/tracks to be plotted. Default: NULL; all animals are plotted.

ask

If TRUE, the execution pauses between each plot.

return

If TRUE, the function returns a ggplot object (which can be edited and plotted manually). If FALSE, the function automatically plots the map (default).

stateNames

Optional character vector of length max(states) indicating state names. Ignored unless states is provided.

projargs

A character string of PROJ.4 projection arguments indicating the coordinate reference system for data and location coordinates (if not longitude and latitude). A CRS object is also permitted. If projargs is provided, the coordinates will be internally transformed to longitude and latitude for plotting.

Details

If the plot displays the message "Sorry, we have no imagery here", try a lower level of zoom.

References

D. Kahle and H. Wickham. ggmap: Spatial Visualization with ggplot2. The R Journal, 5(1), 144-161. URL: http://journal.r-project.org/archive/2013-1/kahle-wickham.pdf


momentuHMM documentation built on Sept. 5, 2021, 5:17 p.m.