Scales

Day 12 of 30DayMapChallenge
R
30DayMapChallenge
datavisualization
spatial
Author

Michaël

Published

2022-11-12

Modified

2024-11-18

Photo of sale rulers

Scale rulers – © by Frank

Day 12 of 30DayMapChallenge: « scales » (previously).

French « départements » at the same size but tidily ordered by area, using data from Adminexpress made in Simplifying polygons layers.

library(tidyverse)
library(sf)
library(units)
library(tmap)

"~/data/adminexpress/adminexpress_cog_simpl_000_2022.gpkg" |> 
  read_sf(layer = "departement") |> 
  filter(!is.na(nom)) |> 
  mutate(surf_km2 = set_units(st_area(geom), km^2), 
         rank = dense_rank(surf_km2), 
         nom_dep = fct_rev(fct_reorder(as_factor(nom), rank))) |> 
  tm_shape() +
  tm_polygons(fill = "lightgrey") +
  tm_facets(by = "nom_dep", free.scales = TRUE)
A small multiple map of french départements ordered by area
Figure 1: Départements