I am trying to create a map with several points (about 20), where each point will be represented by a number, and where a legend will have these numbers and names of my points. Is it possible to do it with the tmap package (or any other R package)?
This is what I have:
library(sf)
#> Linking to GEOS 3.5.0, GDAL 2.1.2, proj.4 4.9.2
library(tmap)
data(Europe)
df_obj <- data.frame(id=c(1,2), name=c("First", "Second"), x=c(0, 25), y=c(45, 50))
sf_obj = st_as_sf(df_obj, coords = c("x", "y"), crs = 4326)
tm_shape(st_as_sf(Europe)) +
tm_polygons() +
tm_text("iso_a3", size="AREA", root=4) +
tm_shape(sf_obj) +
tm_symbols() +
tm_text("id", col="name") +
tm_format_Europe() +
tm_style_bw()
This is what I want (see the legend):