Skip to content

Instantly share code, notes, and snippets.

@16EAGLE
Last active November 8, 2024 18:57
Show Gist options
  • Save 16EAGLE/16f08531f925f9de2286af277089e3d1 to your computer and use it in GitHub Desktop.
Save 16EAGLE/16f08531f925f9de2286af277089e3d1 to your computer and use it in GitHub Desktop.
Short moveVis example on how to display the full traces of each path using trace_show and trace_colour with frames_spatial()
# use moveVis >= 0.10.2 for this example (does not work with CRAN version 0.10.1)
# remotes::install_github("16eagle/moveVis")
library(magrittr)
library(move)
library(moveVis)
data("move_data")
m <- align_move(move_data, res = 4, unit = "mins")
frames <- frames_spatial(m, map_service = "mapbox", map_type = "satellite", map_token = "YOUR_MAPBOX_TOKEN",
path_colours = c("red", "green", "blue"), tail_colour = "white", tail_size = 0.8,
trace_show = T, trace_colour = "white", equidistant = F) %>%
add_labels(x = "Longitude", y = "Latitude") %>%
add_northarrow(colour = "white") %>%
add_scalebar(colour = "white") %>%
add_timestamps(m, type = "label") %>%
add_progress()
animate_frames(frames, out_file = "/full/path/to/file/moveVis_with_trace.gif",
width = 800, height = 550, res = 95,
overwrite = T)
@kaijagahm
Copy link

I'm also hoping to allow the traces to maintain the same color as the associated path, and ideally reduce the alpha. Any idea how to do this?

@markbidwell
Copy link

Hi, frames_spatial() has a "trace_colour" argument which defaults to white but setting trace_colour to a vector of colours (as can be done for path_colours = c("red", "green", "blue") doesn't work. Note the "path colours" argument is plural but "trace_colour" is singular, so this feature works for an animation of one animal's movements but not for multiple animals. Ideally, "path_colours" and "trace_colours" could be set to the same vector of colours, perhaps in a future release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment