Cartogram





A cartogram is a map in which the geometry of regions is distorted in order to convey the information of an alternate variable. The region area will be inflated or deflated according to its numeric value. In R, the cartogram package is the best way to build it, as illustrated in the examples below.

The cartogram package: step by step

The cartogram package allows to build cartograms in R. It requires a geospatial object as input, with a numeric variable in the data slot. This variable will be used to distort region shape. The following example will guide you through the process:




Application on Hexbin map

A hexbin map is a map where each region is represented as an hexagon. It is possible to apply a cartogram algorithm to such a map, as suggested in the example below. Note that you probably want to explore the hexbin map section before making a cartogram with it.




Animated version

The following example describes extensively how to make a smooth transition between a choropleth map and a cartogram. This is possible thanks to the tweenR and the gganimate libraries. See the explanations here. See the animation section for more examples of animation with R.

Code Animation section
Best R Cartogram Examples

The web is full of astonishing R charts made by awesome bloggers. The R graph gallery tries to display some of the best creations and explain how their source code works. If you want to display your work here, please drop me a word or even better, submit a Pull Request!

Related chart types


Map
Choropleth
Hexbin map
Cartogram
Connection
Bubble map