Is there a way to change tm_text position in R?

133 Views Asked by At

I know tm_text() uses centroids to locate labels, however when I try to run the code using the Shapefiles from this webpage (Instituto Dominicano de Datos Espaciales): (https://geoportal.iderd.gob.do/layers/geonode_data:geonode:RD_PROV/metadata_detail) the map locates the provinces names way outside. This is the map I want to replicate with the names exactly in the middle.

enter image description here

The code I use is:

library(tmap)
library(rgdal)
library(dplyr)
library(sf)
library(maptools)
library(rgeos)


map_prov <-  readOGR("RD_PROV.shp")
map_REG <- st_read("RD_REG_20220630.shp")

tmap_mode("plot") + tm_shape(map_prov) +
tm_borders(col="blue") + tm_text("TOPONIMIA", size = "AREA")

The result I get is:(https://i.stack.imgur.com/TFUGR.png)

I need the provinces names more cleanly located as shown above. Also if you know a way to wrap text as shown in first map, it would be great.

0

There are 0 best solutions below