add_mtext: draw a box

View source: R/plot_legend.R

add_mtextR Documentation

draw a box

Description

Similar to mtext allowing adding a text to the margins of a map. This function useds the margins around the mapped area; not the margins that R would use.

Usage

add_mtext(text, side=3, line=0, ...)

Arguments

text

character or expression vector specifying the text to be written

side

integer indicating the margin to use (1=bottom, 2=left, 3=top, 4=right)

line

numeric to move the text in or outwards.

...

arguments passed to text

See Also

add_legend, add_grid, add_box

Examples

f <- system.file("ex/elev.tif", package="terra")
r <- rast(f)

plot(r, axes=FALSE, legend=FALSE)
add_box()
for (i in 1:4) add_mtext("margin text", i, cex=i, col=i, line=2-i)

rspatial/terra documentation built on Sept. 23, 2024, 12:15 a.m.