code/09-tmstyles.R

library(spData)
library(tmap)
legend_title = expression("Area (km"^2*")")
map_nza = tm_shape(nz) +
  tm_fill(col = "Land_area", title = legend_title) + tm_borders()
s1 = map_nza + tm_style("bw") + tm_layout(title = "style: bw")
s2 = map_nza + tm_style("classic") + tm_layout(title = "style: classic")
s3 = map_nza + tm_style("cobalt") + tm_layout(title = "style: cobalt")
s4 = map_nza + tm_style("col_blind") + tm_layout(title = "style: col_blind")
tmap_arrange(s1, s2, s3, s4, nrow = 1)
Robinlovelace/geocompr documentation built on June 14, 2025, 1:21 p.m.