geom_sftrack | R Documentation |
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 class 'sftrack'
geom_sftrack(mapping = ggplot2::aes(), data = NULL, ...)
## S3 method for class 'sftraj'
geom_sftrack(mapping = ggplot2::aes(), data = NULL, ..., step_mode = FALSE)
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 |
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.
#'
require("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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.