This function adds a scalebar to the animation frames created with frames_spatial.

add_scalebar(frames, distance = NULL, height = 0.015,
position = "bottomleft", x = NULL, y = NULL, colour = "black",
label_margin = 1.2, verbose = TRUE)

## Arguments

frames list of ggplot2 objects, crated with frames_spatial. numeric, optional. Distance displayed by the scalebar in km. By default, the displayed distance is calculated automatically. numeric, height of the scalebar in a range from 0 to 1 as the proportion of the overall height of the frame map. Default is 0.015. character, position of the scalebar on the map. Either "bottomleft", "upperleft", "upperright", "bottomright". Ignored, if x and y are set. numeric, position of the bottom left corner of the scalebar on the x axis. If not set, position is used to calculate the position of the scalebar. numeric, position of the bottom left corner of the scalebar on the y axis. If not set, position is used to calculate the position of the scalebar. character, colour of the distance labels. Default is "black". numeric, distance of the labels to the scalebar as a proportion of the height of the scalebar (e.g. if set to 2, the labels will be positioned with a distance to the scalebar of twice the scalebar height). logical, if TRUE, messages on the function's progress are displayed (default).

## Value

List of frames.

frames_spatial frames_graph animate_frames

## Examples

# NOT RUN {
library(moveVis)
library(move)

data("move_data", "basemap_data")
m <- align_move(move_data, res = 4, unit = "mins")

# create spatial frames using a custom NDVI base layer
r_list <- basemap_data[[1]]
r_times <- basemap_data[[2]]

# }# NOT RUN {
frames <- frames_spatial(m, r_list = r_list, r_times = r_times, r_type = "gradient",
# }