Adds a scale bar to maps created with plot_rast_gg
.
sprawl_scalebar(in_obj, location = "bottomright", scalebar_dist = NULL,
height = 0.02, st.dist = 0.01, st.bottom = TRUE, st.size = 3.5,
st.color = "black", box.fill = c("black", "white"),
box.color = "black", dd2km = FALSE, model, x.min, x.max, y.min,
y.max, anchor = NULL, facet.var = NULL, facet.lev = NULL,
units = "m")
Arguments
in_obj |
Raster object passed to plot_rast_gg or plot_vect to which
the scalebar should be added;
|
location |
character ["bottomright" | "bottomleft" | "topleft" | "topright"]
indicating where the scalebar should be placed, Default: "bottomright"
|
scalebar_dist |
numeric distance in to represent with each segment of the scale bar.
|
height |
numeric value between 0 and 1 to indicate the height of the
scale bar, as a proportion of the y axis, Default: 0.02
|
st.dist |
numeric value between 0 and 1 to indicate the distance
between the scale bar and the scale bar text, as a proportion of the y axis,
Default: 0.02
|
st.bottom |
logical If TRUE (default) the scale bar text is displayed
at the bottom of the scale bar, if FALSE, it is displayed at the top.
|
st.size |
numeric value to indicate the scale bar text size. It is
passed to the size argument of ggplot::annotate function.
|
st.color |
Text color for the scalebar, Default: 'black' |
box.fill |
fill colors for the scalebar polygons,
Default: c("black", "white") |
box.color |
line color for the scalebar polygons, Default: 'black' |
dd2km |
logical If TRUE it is assumed that map coordinates are in
decimal degrees, if FALSE, it assumed they are in meters, Default: FALSE
|
model |
character choice of ellipsoid model ("WGS84", "GRS80", "Airy",
"International", "Clarke", "GRS67"). Ignored if dd2km is FALSE.
|
x.min |
if data is not defined, number with the minimum x coordinate. |
x.max |
if data is not defined, number with the maximum x coordinate. |
y.min |
if data is not defined, number with the minimum y coordinate. |
y.max |
if data is not defined, number with the maximum y coordinate. |
anchor |
named numeric(2) with coordinates to control the
symbol position. For location = "topright" , anchor
defines the coordinates of the symbol's topright corner and so forth.
The x coordinate must be named as x and the y coordinate as y.
|
facet.var |
if faceting, character vector of variable names used for
faceting. This is useful for placing the scalebar only in one facet and must
be used together with facet.lev . |
facet.lev |
character vector with the name of one level for each
variable in facet.var . The scale bar will be drawn only in the facet.lev
facet. |
units |
DESCRIPTION |
Details
Simple modifications on the scalebar
function in package ggsn