Learn R Programming

tmap (version 1.2)

tm_credits: Credits text

Description

Creates a text annotation that could be used for credits or acknowledgements.

Usage

tm_credits(text, size = 0.7, col = NA, alpha = NA, align = "left",
  bg.color = NA, bg.alpha = NA, fontface = NA, fontfamily = NA,
  position = NA)

Arguments

text
text. Multiple lines can be created with the line break symbol "\n".
size
relative text size
col
color of the text. By default equal to the argument attr.color of tm_layout.
alpha
transparency number between 0 (totally transparent) and 1 (not transparent). By default, the alpha value of col is used (normally 1).
align
horizontal alignment: "left" (default), "center", or "right". Only applicable if text contains multiple lines
bg.color
background color for the text
bg.alpha
Transparency number between 0 (totally transparent) and 1 (not transparent). By default, the alpha value of the bg.color is used (normally 1).
fontface
font face of the text. By default, determined by the fontface argument of tm_layout.
fontfamily
font family of the text. By default, determined by the fontfamily argument of tm_layout.
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, NLD_prov)

tm_shape(NLD_muni) +
    tm_fill(col="population", convert2density=TRUE, 
        style="kmeans", title="Population (per km2)") +
    tm_borders("grey25", alpha=.5) + 
    tm_shape(NLD_prov) +
    tm_borders("grey40", lwd=2) +
tm_format_NLD(bg.color="white", frame = TRUE) +
tm_credits("(c) Statistics Netherlands (CBS) and\nKadaster Nederland", position=c("left", "bottom"))

Run the code above in your browser using DataLab