[GIS] Styling header in R tmap::tm_facets

rstyle

I am generating some maps and animations with tmap, using tm_facets.
The default style shows rather ugly grey headers for each small map. How can I change the style of the header (position, font size/family, background colour)?
enter image description here

tm_shape(Europe) +
    tm_polygons("well_being", title="Well-Being Index") +
    tm_facets("part", free.coords=FALSE) +
tm_style_grey()

Similar code snippets are available in the R Vignette.

Best Answer

Use tm_layout(panel.label.X) to change options:

library(tmap)

data(Europe)

tm_shape(Europe) +
  tm_polygons("well_being", title="Well-Being Index") +
  tm_facets("part", free.coords=FALSE) +
  tm_layout(panel.labels = c('facet1','facet2','facet3','facet4','facet5'),
            panel.label.size = 1.5, panel.label.color = 'white',
            panel.label.bg.color = 'blue', panel.label.height = 1.1,
            panel.label.rot = c(0,45))

enter image description here

Related Question