add_scalebar | R Documentation |
This function adds a scalebar to 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,
units = "km",
verbose = TRUE
)
frames |
an object of class |
distance |
numeric, optional. Distance displayed by the scalebar (in either km or miles defined by argument |
height |
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. |
position |
character, position of the scalebar on the map. Either |
x |
numeric, position of the bottom left corner of the scalebar on the x axis. If not set, |
y |
numeric, position of the bottom left corner of the scalebar on the y axis. If not set, |
colour |
character, colour of the distance labels. Default is |
label_margin |
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). |
units |
character, either "km" for kilometers or "miles" for miles. |
verbose |
logical, if |
A frames object of class moveVis
.
Jakob Schwalb-Willmann
frames_spatial
frames_graph
animate_frames
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",
fade_raster = TRUE)
# add a scale bar to frames:
frames.a <- add_scalebar(frames)
frames.a[[100]]
# or in white at another position
frames.b <- add_scalebar(frames, colour = "white", position = "bottomright")
frames.b[[100]]
# or with another height
frames.c <- add_scalebar(frames, colour = "white", position = "bottomright", height = 0.025)
frames.c[[100]]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.