2

I have created a great map using the code below but got a problem with labels. The labels overlaps with each other and become unreadable. How can I fix this?

My map :

enter image description here

  Per65_Both <- 
   tm_shape(nhmap) +
   tm_fill ("Per65", title="65+%",palette = "RdYlGn",
            breaks = c(9, 14.9, 19.9, 24.9, 30)) +
   tm_facets("Year_", free.coords=TRUE) +
   tm_polygons("Per65", palette = "RdYlGn", auto.palette.mapping=FALSE,
               legend.format=list(fun=function(x) paste0(formatC(x, digits=0, format="f"), "%"))) +
   tm_borders (alpha = .1 , col="black", lwd=0.5) +
   tm_text("NAME",col="black", size=0.65,  bg.alpha = .5, ymod=0.2, 
           print.tiny = T, auto.placement = F, fontface = 2) +
   tm_shape(nhmap) +
   tm_facets("Year_", free.coords=TRUE) +
   tm_borders (alpha = .1 , col="black", lwd=0.5) +
   tm_layout( 
     frame = F,
     legend.stack = "horizontal",
     legend.title.size = 1,
     legend.text.size = .75,
     legend.position =c("right", "bottom"),
     legend.bg.color = "white",
     legend.bg.alpha = 0,
     legend.width = 0.9,
     legend.height = 0.9,
     legend.hist.height = 0.3,
     fontfamily = "serif", 
     legend.show = T,
     legend.only = F)+
   tm_text("Per65_",col="black",size=0.55,  bg.alpha = .5, xmod=0.2,
           ymod=-0.25, fontface = 2,just=c("center", "center"), remove.overlap = F)  
lovalery
  • 4,524
  • 3
  • 14
  • 28
MRR
  • 23
  • 2
  • 1
    Would be nice to have something to "repel" labels (see this [github issue](https://github.com/r-tmap/tmap/issues/337))... – Ben Apr 10 '22 at 20:15

0 Answers0