Learn R Programming

tmap (version 1.2)

tm_scale_bar: Scale bar

Description

Creates a scale bar. By default, the coordinate units are assumed to be meters, and the map units in kilometers. This can be changed in tm_shape.

Usage

tm_scale_bar(breaks = NULL, width = 0.25, size = 0.5, text.color = NA,
  color.dark = "black", color.light = "white", position = NA)

Arguments

breaks
breaks of the scale bar. If not specified, breaks will be automatically be chosen given the prefered width of the scale bar.
width
(prefered) width of the scale bar. Only applicable when breaks=N ULL
size
relative text size (which is upperbound by the available label width)
text.color
color of the text. By default equal to the argument attr.color of tm_layout.
color.dark
color of the dark parts of the scale bar, typically (and by default) black.
color.light
color of the light parts of the scale bar, typically (and by default) white.
position
position of the text. Vector of two values, specifing the x and y coordinates. Either this vector contains "left", "LEFT", "center", "right", or "RIGHT" for the first value and "top", "TOP", "center", "bottom", or "BOTTOM" for the second value, or this ve

Examples

Run this code
data(NLD_muni)
qtm(NLD_muni, theme = "NLD") + tm_scale_bar(position=c("left", "bottom"))

data(Europe)
tm_shape(Europe, unit = "miles", unit.size=1609) + tm_polygons() + tm_scale_bar()

Run the code above in your browser using DataLab