Put labels on a map.

labelLayer(
x,
spdf,
df,
spdfid = NULL,
dfid = NULL,
txt,
col = "black",
cex = 0.7,
overlap = TRUE,
show.lines = TRUE,
halo = FALSE,
bg = "white",
r = 0.1,
...
)

## Arguments

x an sf object, a simple feature collection. spdf, df, dfid and spdfid are not used. a SpatialPointsDataFrame or a SpatialPolygonsDataFrame; if spdf is a SpatialPolygonsDataFrame texts are plotted on centroids. a data frame that contains the labels to plot. If df is missing spdf@data is used instead. name of the identifier variable in spdf, default to the first column of the spdf data frame. (optional) name of the identifier variable in df, default to the first column of df. (optional) labels variable. labels color. labels cex. if FALSE, labels are moved so they do not overlap. if TRUE, then lines are plotted between x,y and the word, for those words not covering their x,y coordinate If TRUE, then a 'halo' is printed around the text and additional arguments bg and r can be modified to set the color and width of the halo. halo color if halo is TRUE width of the halo further text arguments.

## Examples

library(sf)
opar <- par(mar = c(0,0,0,0))
#> Reading layer mtq' from data source
#>   /tmp/RtmppBiN3A/temp_libpath43d97684eada/cartography/gpkg/mtq.gpkg'
#>   using driver GPKG'
#> Simple feature collection with 34 features and 7 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 690574 ymin: 1592536 xmax: 735940.2 ymax: 1645660
#> Projected CRS: WGS 84 / UTM zone 20Nplot(st_geometry(mtq), col = "darkseagreen3", border = "darkseagreen4",
bg = "#A6CAE0")
labelLayer(x = mtq, txt = "LIBGEO", col= "black", cex = 0.7, font = 4,
halo = TRUE, bg = "white", r = 0.1,
overlap = FALSE, show.lines = FALSE)
par(opar)
`