This function can be added to ggplot() to plot an sftrack and sftraj Function does not yet work with ggplot grammer so you must but data= in this function

geom_sftrack(mapping, data, ...)

# S3 method for sftrack
geom_sftrack(mapping = ggplot2::aes(), data = NULL, ...)

# S3 method for sftraj
geom_sftrack(mapping = ggplot2::aes(), data = NULL, ..., step_mode = FALSE)

Arguments

mapping

mapping aesthetics for ggplot.

data

the sftraj or sftrack object.

...

arguments to passed to ggplot

step_mode

TRUE/FALSE, whether to plot in step_mode, See details

Details

step mode refers to considering the trajectory as individual 'steps', in the case of plot this means it will plot each line & point individually. This approach is much slower to plot when n(steps)>10,000. The alternative method is to merge the steps into a multilinestring of continuous lines. This is much faster to plot.

Examples

#'
require("ggplot2")
#> Loading required package: ggplot2
data("raccoon")
raccoon$timestamp <- as.POSIXct(raccoon$timestamp, "EST")
burstz <- c(id = "animal_id")

# sftraj will as well for the most part, however as its a more complex
# structure to speed up plotting.
my_sftraj <- as_sftraj(raccoon,
  time = "timestamp",
  coords = c("longitude", "latitude"),
  group = burstz
)

ggplot() +
  geom_sftrack(data = my_sftraj)