2

I made a map using the tmap package. This map is displayed in view mode and has facets. I would like the legend to appear only once, outside of the graph/facets, at the bottom and stacked horizontally.

I cannot share the original data but here is a hopefully reproducible example:

library(tmap)
library(tmaptools)

data(World, NLD_muni, NLD_prov, land, metro)

tmap_mode("view")

map <- tm_shape(NLD_muni) +
  tm_borders() +
  tm_facets(by="province", free.scales = F) +
  tm_fill("population", style="kmeans", convert2density = TRUE) +
  tm_shape(NLD_prov) +
  tm_borders(lwd=4) +
  tm_facets(by="name") +
  tm_legend(legend.outside = T, legend.stack = "horizontal", legend.outside.position = 'bottom')
map

You can see in tm_legend() what I have already tried, to no avail. Would anybody have any pointers?

lovalery
  • 4,524
  • 3
  • 14
  • 28
Romain
  • 171
  • 11
  • 1
    According to the [documentation](https://rdrr.io/cran/tmap/man/tmap_mode.html) small multiples are not supported yet. Thus, it's not possible to get only one legend in view mode. – mgrund Mar 17 '22 at 12:16
  • Thanks for looking into this. – Romain Mar 20 '22 at 20:31

0 Answers0