# ggspatial::annotation_scale()
## can be used as parameters or aesthetics.
## aesthetics when different scale bar in different panels.
## Otherwise, just pass them as arguments to annotation_scale.
## width_hint: The (suggested) proportion of the plot area which the scalebar should occupy.
## unit_category: Use "metric" or "imperial" units.
## style: One of "bar" or "ticks"
## location: Where to put the scale bar ("tl" for top left, etc.)
## line_col and text_col: Line and text colour, respectively
#' @export
scale_bar <- function(...){
ggspatial::annotation_scale(
mapping = NULL,
data = NULL,
width_hint = 0.5,
unit_category = "imperial",
style = 'bar',
location = 'bl',
plot_unit = NULL,
bar_cols = c("black", "white"),
line_width = 1,
height = grid::unit(0.25, "cm"),
pad_x = grid::unit(0.25, "cm"),
pad_y = grid::unit(0.25, "cm"),
text_pad = grid::unit(0.15, "cm"),
text_cex = 0.7,
text_face = NULL,
text_family = "",
tick_height = 0.6)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.