Learn R Programming

cartography (version 2.1.0)

barscale: Scale Bar

Description

Plot a scale bar.

Usage

barscale(size = NULL, lwd = 1.5, cex = 0.6, pos = NULL,
  style = "pretty")

Arguments

size

size of the scale bar in kilometers. If set to NULL, an automatic size is used (1/10 of the map width).

lwd

width of the scale bar.

cex

cex of the text.

pos

position of the legend, default to the bottom right corner of the map. A vector of two coordinates (c(x, y)) is possible.

style

style of the legend, either "pretty" or "oldschool". The "oldschool" style only uses the "size" parameter.

See Also

layoutLayer

Examples

Run this code
# NOT RUN {
data("nuts2006")
library(sp)
plot(nuts0.spdf, col = "grey60",border = "grey20", add=FALSE)
barscale(size = 1000)
barscale(size = 500, lwd = 3, cex = .9, pos = c(3553000, 1449000))

library(sf)
mtq <- st_read(system.file("shape/martinique.shp", package="cartography"))
plot(st_geometry(mtq), col = "grey60", border = "grey20")
barscale(style = "oldschool")
# }

Run the code above in your browser using DataLab