Skip to content

Instantly share code, notes, and snippets.

Last active March 7, 2019 09:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Short moveVis example on how to adapt the path legend of frames created with frames_spatial()
# align movement to unique times and regular resolution
m <- align_move(move_data, res = 4, unit = "mins")
# some path colours by individual
m.list <- split(m) # split m into list by individual
m.list <- mapply(x = m.list, y = c("red", "green", "blue"), function(x, y){
x$colour <- y
m <- moveStack(m.list)
# define legend title when calling frames_spatial()
frames <- frames_spatial(m, map_type = "watercolor", path_legend = T, path_legend_title = "A title")
frames[[100]] # have a look
# change legend title afterwards, allows you to also adjust its appearance: e.g. red and bold
frames <- add_gg(frames, expr(list(guides(colour = guide_legend(title = "Changed title")),
theme(legend.title = element_text(colour = "red", size=10, face = "bold")))))
frames[[100]] # have a look
# change legend items by overwriting legend with manual colours and labels
frames <- add_gg(frames, expr(scale_colour_manual(values = c("green", "red", "blue") , labels = c("T342g", "T246a", "T932u"))))
frames[[100]] # have a look
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment