Small multiples of one choropleth, drawn once per projection, so the cost of a projection choice is visible rather than asserted. The data and the classification are held fixed; only the CRS varies.
Arguments
- data
An
sfmap-ready frame (projections are ansf-backend feature; the polygon backend draws incoord_quickmap()and cannot reproject).- fill
The fill column (unquoted).
- projections
Projections to compare (default: Equal Earth, Robinson, Winkel tripel and Mercator – an equal-area, two compromises and a conformal). See
projection_info().- ncol
Number of facet columns.
- labeller
"name"(default) labels each panel with the projection name;"property"appends what it preserves, which is the point of the comparison.- ...
Passed to
world_map()(e.g.style,palette,n_bins).- projection
Not an argument of this function. It exists only to catch the singular spelling, which R's partial matching would otherwise bind to
projections– drawing a single panel from a function whose purpose is several. Passing it is an error; useprojections.
Examples
# \donttest{
if (requireNamespace("sf", quietly = TRUE) &&
requireNamespace("rnaturalearth", quietly = TRUE)) {
attach_geometry(countryatlas::world_snapshot$countries, geometry = "sf") |>
projection_compare(gdp_per_capita, style = "quantile")
}
# }
