size: size of the scale bar in scale units (scale_units, default to km). If size is not set, an automatic size is used (1/10 of the map width).
pos: position. It can be one of 'bottomright', 'bottomleft', 'interactive' or a vector of two coordinates in map units (c(x, y)).
lwd: line width of the scale bar
cex: size of the scale bar text
col: color of the scale bar (line and text)
crs_units: units used in the CRS of the currently plotted layer. Possible values are "m" and "ft" (see Details).
scale_units: units used for the scale bar. Can be "mi" for miles, "ft" for feet, "m" for meters, or "km" for kilometers (default).
x: object of class crs, sf or sfc. If set, the CRS of x will be used instead of crs_units to define CRS units.
unit: deprecated, use scale_units instead
Returns
No return value, a scale bar is displayed.
Details
Most CRS use the meter as unit. Some US CRS use feet or US survey feet. If unsure of the unit used in the CRS you can use the x argument of the function. Alternatively, you can use sf::st_crs(zz, parameters = TRUE)$units_gdal to see which units are used in the zz layer.
This scale bar does not work on unprojected (long/lat) maps.