1

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.

  • Can you share your code that produces that set of faceted plots in your question? I don't think its one of the examples in help(tm_facet) (unless we're on different versions)... – Spacedman Feb 11 '18 at 11:03
  • Any example in the link above will do. – Strabonio Feb 11 '18 at 19:25
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.