# cartogram_cont: Calculate Contiguous Cartogram Boundaries In cartogram: Create Cartograms with R

## Description

Construct a continuous area cartogram by a rubber sheet distortion algorithm (Dougenik et al. 1985)

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28``` ```cartogram_cont( x, weight, itermax = 15, maxSizeError = 1.0001, prepare = "adjust", threshold = 0.05 ) ## S3 method for class 'SpatialPolygonsDataFrame' cartogram_cont( x, weight, itermax = 15, maxSizeError = 1.0001, prepare = "adjust", threshold = 0.05 ) ## S3 method for class 'sf' cartogram_cont( x, weight, itermax = 15, maxSizeError = 1.0001, prepare = "adjust", threshold = 0.05 ) ```

## Arguments

 `x` SpatialPolygonDataFrame or an sf object `weight` Name of the weighting variable in x `itermax` Maximum iterations for the cartogram transformation, if maxSizeError ist not reached `maxSizeError` Stop if meanSizeError is smaller than maxSizeError `prepare` Weighting values are adjusted to reach convergence much earlier. Possible methods are "adjust", adjust values to restrict the mass vector to the quantiles defined by threshold and 1-threshold (default), "remove", remove features with values lower than quantile at threshold, "none", don't adjust weighting values `threshold` Define threshold for data preparation

## Value

An object of the same class as x

## References

Dougenik, J. A., Chrisman, N. R., & Niemeyer, D. R. (1985). An Algorithm To Construct Continuous Area Cartograms. In The Professional Geographer, 37(1), 75-81.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29``` ```library(maptools) library(cartogram) library(rgdal) data(wrld_simpl) # Remove uninhabited regions afr <- spTransform(wrld_simpl[wrld_simpl\$REGION==2 & wrld_simpl\$POP2005 > 0,], CRS("+init=epsg:3395")) # Create cartogram afr_carto <- cartogram_cont(afr, "POP2005", 3) # Plot par(mfcol=c(1,2)) plot(afr, main="original") plot(afr_carto, main="distorted (sp)") # Same with sf objects library(sf) afr_sf = st_as_sf(afr) afr_sf_carto <- cartogram_cont(afr_sf, "POP2005", 3) # Plot par(mfcol=c(1,3)) plot(afr, main="original") plot(afr_carto, main="distorted (sp)") plot(st_geometry(afr_sf_carto), main="distorted (sf)") ```

cartogram documentation built on Aug. 27, 2020, 1:10 a.m.