Function Repository Resource:

Cartogram

Source Notebook

Generate geometrically distorted maps, where the distortion conveys information derived from the input data

Contributed by: Richard Lapin

ResourceFunction["Cartogram"][reg]

generates a plot of width 100 in which geographic region reg specified in the form of an Entity object are displayed after 30 iterations; the destortion is based on equalising the population densities by default.

ResourceFunction["Cartogram"][{reg1val1,reg2val2,}]

generates a plot in which geographic regions reg1 and reg2 specified in the form of Entity objects are displayed after 30 iterations, where the distortion is based on the values val1 and val2.

ResourceFunction["Cartogram"][reg,iterations]

generates a plot in which geographic region reg is displayed after the specified number of iterations.

ResourceFunction["Cartogram"][reg,iterations,res]

generates a plot of width res.

ResourceFunction["Cartogram"][reg,iterations,res,plotAll]

generates a list of plots of width res from the undistorted map to the specified number of iterations.

Details and Options

The reg can be Entity objects such as countries corresponding to extended geographic regions or geometric constructs with GeoPosition coordinates.
The val must be a number.

Examples

Basic Examples (3) 

Cartogram works with a single geographic entity:

In[1]:=
ResourceFunction["Cartogram"][EntityClass["Country", "CentralEurope"]]
Out[1]=

A list of countries:

In[2]:=
ResourceFunction[
 "Cartogram"][{Entity["Country", "Germany"], Entity["Country", "Poland"], Entity["Country", "France"]}]
Out[2]=

A list of countries using user-input values:

In[3]:=
ResourceFunction[
 "Cartogram"][{Entity["Country", "Germany"] -> 100, Entity["Country", "Poland"] -> 101, Entity["Country", "France"] -> 150}]
Out[3]=

Options (3) 

Run Cartogram for just one iteration:

In[4]:=
ResourceFunction[
 "Cartogram"][{Entity["Country", "Germany"] -> 100, Entity["Country", "Poland"] -> 101, Entity["Country", "France"] -> 150}, 1]
Out[4]=

Run it for five iterations with a width of 400 pixels.

In[5]:=
ResourceFunction[
 "Cartogram"][{Entity["Country", "Germany"] -> 100, Entity["Country", "Poland"] -> 101, Entity["Country", "France"] -> 150}, 5, 400]
Out[5]=

Return all steps of first five iterations:

In[6]:=
ResourceFunction[
 "Cartogram"][{Entity["Country", "Germany"] -> 100, Entity["Country", "Poland"] -> 101, Entity["Country", "France"] -> 101}, 5, 200, True]
Out[6]=

Publisher

Richard Lapin

Version History

  • 1.0.0 – 10 July 2019

Source Metadata

Author Notes

High resolution iterations are computationally intensive and take a long time. For instance, 500 iterations of contiguous US states at resolution of 1000 took around 3 hours (link for the output below): https://youtu.be/ggcOGzDh1qo

License Information