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
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:
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