cartogram_ncont {cartogram} | R Documentation |
Calculate Non-Contiguous Cartogram Boundaries
Description
Construct a non-contiguous area cartogram (Olson 1976).
Usage
cartogram_ncont(x, weight, k = 1, inplace = TRUE)
## S3 method for class 'SpatialPolygonsDataFrame'
cartogram_ncont(x, weight, k = 1, inplace = TRUE)
## S3 method for class 'sf'
cartogram_ncont(x, weight, k = 1, inplace = TRUE)
Arguments
x |
a polygon or multiplogyon sf object |
weight |
Name of the weighting variable in x |
k |
Factor expansion for the unit with the greater value |
inplace |
If TRUE, each polygon is modified in its original place, if FALSE multi-polygons are centered on their initial centroid |
Value
An object of the same class as x with resized polygon boundaries
References
Olson, J. M. (1976). Noncontiguous Area Cartograms. In The Professional Geographer, 28(4), 371-380.
Examples
library(sf)
library(cartogram)
nc = st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)
# transform to NAD83 / UTM zone 16N
nc_utm <- st_transform(nc, 26916)
# Create cartogram
nc_utm_carto <- cartogram_ncont(nc_utm, weight = "BIR74")
# Plot
par(mfrow=c(2,1))
plot(nc[,"BIR74"], main="original", key.pos = NULL, reset = FALSE)
plot(st_geometry(nc_utm), main="distorted", reset = FALSE)
plot(nc_utm_carto[,"BIR74"], add =TRUE)
[Package cartogram version 0.3.0 Index]