
tmap-element
that adds text labels.tm_text(text, size = 1, root = 3, fontcolor = NA, fontface = "plain",
fontfamily = "sans", alpha = NA, case = NA, shadow = FALSE,
bg.color = NA, bg.alpha = NA, size.lowerbound = 0.4,
print.tiny = FALSE, scale = 1, xmod = 0, ymod = 0)
"AREA"
, where the text size is proportional to the area size of the polsize
is a variable name or "AREA"
. If root=2
, the square root is taken, if root=3
, the cube root etc.fontcolor
is used (normally 1).NA
to leave the text as is.fontcolor
.bg.color=NA
, so no background is drawn.size
. Only useful when size
is not a constant. If print.tiny
is TRUE
, then all text labels which relative text is smaller than size.lowerbound
are depicted at relative size size.lowerbound
size
is variable or "AREA"
.vignette("tmap-nutshell")
}# World example
data(World)
tm_shape(World) +
tm_text("name", size="AREA")
# Europe example
data(Europe)
tm_shape(Europe) +
tm_polygons() +
tm_text("iso_a3", size="AREA", root=4, shadow = TRUE, fontcolor = "grey20", scale=2,
size.lowerbound = .1) +
tm_shape(Europe) +
tm_text("name", size="AREA", root=4, scale=1,
ymod=-.04 * approx_areas(Europe, unit = "norm")^(1/4))
Run the code above in your browser using DataLab