9.6 Elements
9.6.1 Compass and Scale Bar
+
map_nz tm_compass(type = "8star", position = c("left", "top")) +
tm_scale_bar(breaks = c(0, 100, 200), text.size = 1)
9.6.2 Settings
<- map_nz + tm_layout(title = "New Zealand")
misc_map1 <- map_nz + tm_layout(scale = 5)
misc_map2 <- map_nz + tm_layout(bg.color = "lightblue")
misc_map3 <- map_nz + tm_layout(frame = FALSE)
misc_map4
tmap_arrange(misc_map1, misc_map2, misc_map3, misc_map4)
Other arguments
- Frame width (
frame.lwd
) and an option to allow double lines (frame.double.line
) - Margin settings including
outer.margin
andinner.margin
- Font settings controlled by
fontface
andfontfamily
- Legend settings including binary options such as
legend.show
(whether or not to show the legend),legend.only
(omit the map), andlegend.outside
(should the legend go outside the map?), as well as multiple choice settings such aslegend.position
- Default colors of aesthetic layers (
aes.color
), map attributes such as the frame (attr.color
) - Color settings controlling
sepia.intensity
(how yellowy the map looks) and saturation (a color-grayscale)
9.6.3 Themes
<- map_nz + tm_style("bw")
theme_example_1 <- map_nz + tm_style("classic")
theme_example_2 <- map_nz + tm_style("cobalt")
theme_example_3 <- map_nz + tm_style("col_blind")
theme_example_4
tmap_arrange(theme_example_1, theme_example_2,
theme_example_3, theme_example_4)
- Additional resource: How do you position the title and legend in tmap? at Stack Overflow