3

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.

2
  • 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
    Commented Feb 11, 2018 at 11:03
  • Any example in the link above will do.
    – Strabonio
    Commented Feb 11, 2018 at 19:25

1 Answer 1

7

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 and acknowledge you have read our privacy policy.

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