Resizes countries by weight (population, GDP, ...) via the optional
cartogram package, defeating the "big empty countries dominate the eye"
bias of world choropleths.
Usage
cartogram_map(
data,
weight,
type = c("contiguous", "dorling", "noncontiguous"),
fill = NULL,
projection = "equal_earth",
...
)Arguments
- data
An
sfmap-ready frame.- weight
The column to resize by (unquoted).
- type
"contiguous"(default),"dorling"or"noncontiguous".- fill
Optional fill column (unquoted); defaults to
weight.- projection
Projection; an equal-area CRS is recommended. See
world_map()for the projections available.- ...
Passed to the underlying
cartogram::cartogram_*()function (e.g.itermax, orkfortype = "dorling"– seedorling_map()).
Examples
# \donttest{
if (requireNamespace("sf", quietly = TRUE) &&
requireNamespace("rnaturalearth", quietly = TRUE) &&
requireNamespace("cartogram", quietly = TRUE)) {
attach_geometry(countryatlas::world_snapshot$countries, geometry = "sf") |>
cartogram_map(population, type = "dorling")
}
# }
