Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
A cellular automata method for creating cartograms
ResourceFunction["CellularAutomataCartogram"][loc→val] attempts to equalize the density of val over an area by adjusting the boundaries of loc. | |
ResourceFunction["CellularAutomataCartogram"][{loc1→val1,loc2→val2,…}] attempts to equalize the density of vali over an area by adjusting the boundaries of loci. |
Use a small RasterSize to reduce the number of pixels and thus speed up the calculation. Check the initial state:
| In[1]:= | ![]() |
| Out[1]= | ![]() |
Equalize the density:
| In[2]:= | ![]() |
| Out[2]= | ![]() |
Check the result:
| In[3]:= |
| Out[3]= |
| In[4]:= |
| Out[4]= |
Here is the same example in a colorized version:
| In[5]:= | ![]() |
| Out[5]= | ![]() |
Adjust the administrative division boundaries of the UK to equalize population density:
| In[6]:= | ![]() |
| In[7]:= | ![]() |
Initial state:
| In[8]:= |
| Out[8]= | ![]() |
Final state after population density adaptation:
| In[9]:= |
| Out[9]= | ![]() |
Adjust the size of the image, which affects rasterization and thus the final result:
| In[10]:= | ![]() |
| Out[10]= | ![]() |
Adjust the raster size of the image, which affects the final result:
| In[11]:= | ![]() |
| Out[11]= | ![]() |
The initial state is the zeroth iteration:
| In[12]:= | ![]() |
| Out[12]= | ![]() |
The Gini coefficient is a measure of statistical dispersion. A Gini coefficient of zero expresses perfect equality, where all values are the same. A Gini coefficient of 1 expresses maximal inequality among values. The Gini coefficient is calculated each 100th iteration:
| In[13]:= | ![]() |
| Out[13]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License