3

Here is a reproducible example

library(tmap)

data("World")
tm_shape(World) +
  tm_polygons("pop_est", style = "cont", legend.is.portrait=FALSE) +
  tm_facets("continent") +
  tm_layout(legend.position = c("left", "bottom"),
            main.title = "Population",
            main.title.position = "centre")

tmap plot with facets

I want the legend to be placed below the facets to better use the space and get everything more centered. Any ideas how I can do this?

1 Answers1

6

You could try putting the legend outside the plot and centering it:

data("World")
tm_shape(World) +
  tm_polygons("pop_est", style = "cont", legend.is.portrait = FALSE) +
  tm_facets("continent") +
  tm_layout(legend.outside = TRUE,
            legend.outside.position = "bottom",
            legend.position = c(0.25, 0.25),
            main.title = "Population",
            main.title.position = "centre")

enter image description here

Allan Cameron
  • 147,086
  • 7
  • 49
  • 87