Glyphs in spatial data visualization are graphical symbols that represent data values at specific geographic locations. Each glyph can encode multiple data variables.
With the extension package tmap.glyphs (in development) glyphs can be created. Currently only the donut and flower glyphs are implemented.
Donut maps
ZH_muni = NLD_muni[NLD_muni$province == "Zuid-Holland", ]
ZH_muni$income_middle = 100 - ZH_muni$income_high - ZH_muni$income_low
which.max(ZH_muni$population)
#> [1] 26
ZH_muni$population[c(10,26)] = 500000
ZH_muni$income_high[1:15] = NA
tm_shape(ZH_muni) +
tm_polygons() +
tm_donuts(parts = tm_vars(c("income_low", "income_middle", "income_high"), multivariate = TRUE),
fill.scale = tm_scale_categorical(values = "-pu_gn_div"),
size = "population",
lwd = 1,
size.scale = tm_scale_continuous(ticks = c(50000, 100000, 250000, 500000)),
options = opt_tm_donuts(fill_hole = FALSE))
Flower maps
library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.4.0; sf_use_s2() is TRUE
q = function(x) {
r = rank(x)
r[is.na(x)] = NA
r = r / max(r, na.rm = TRUE)
r
}
World$norm_well_being = q((World$well_being / 8))
World$norm_footprint = q(((50 - World$footprint) / 50))
World$norm_inequality = q(((65 - World$inequality) / 65))
World$norm_press = q(1 - ((100 - World$press) / 100))
World$norm_gender = q(1 - World$gender)
tm_shape(World) +
tm_polygons(fill = "white", popup.vars = FALSE) +
tm_shape(World) +
tm_flowers(parts = tm_vars(c("norm_gender", "norm_press", "norm_footprint", "norm_well_being", "norm_inequality"), multivariate = TRUE),
fill.scale = tm_scale(values = "friendly5"),
size = 1, popup.vars = c("norm_gender", "norm_press", "norm_footprint", "norm_well_being","norm_inequality"), id = "name") +
tm_basemap(NULL) +
tm_layout(bg.color = "grey90")
#> [tip] Consider a suitable map projection, e.g. by adding `+ tm_crs("auto")`.
#> This message is displayed once per session.