A cartogram is a  map in which the geometry of regions is distorted in order to convey the information of an alternate variable. For example, a world map in which the countries with a large population are drawn wider.Cartograms are particularly useful to correct

the biais that can be observed in a chloropleth map: when you aggregate a variable per region, a region with very few data points will look as important as a region with many data points! Cartograms correct this artefact. In R, the cartogram library allows

to make this correction. It needs a spatial object as input, and will use one the column of the data slot to make the correction. It returns a new spatial object that you can plot with the methods described in the other map sections!




Cartogram & chloropleth

The graph #331 explain how to go from a basic map to a cartogram. Once you got the cartogram spatial object, you can apply any usual method to draw it, like ggplot2.

Apply it to hexbin map

Exactly the same technique can be applied to a map were each region is represented by an hexagon (hexbin map). Here is an example with the US population per state:

Animated version

The graph #333 describes extensively how to make a smooth transition between a chloropleth 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.



Search the gallery