Visualise data on a map by distorting the regions to make their areas proportional to the data values
Some example data for India is given, including only the states and Delhi. Jammu & Kashmir is taken as the pre-bifurcation state.
- population.dat: Population of states in the 2011 census
- popincrease.dat: Population increase from 2001-11
- LSseats.dat: Lok Sabha seats
- gdp.dat: Gross state domestic product (2018) from http://mospi.nic.in
- covidcases.dat: Confirmed COVID cases as of 21 May, 2021 from https://www.covid19india.org/
- coviddeaths.dat: COVID deaths
First, build the program using
g++-11 -O3 -W -Wall -Wno-unused-result -std=c++2a weighted_distort.cpp -o weighted_distort
You would need a modern C++ compiler.
To modify a map you can then use
echo input.map data_input.dat num_rounds | ./weighted_distort > map_output.dat
input.map
is the input map with one region per line. Unfortunately, the program only works with regions that are pseudo-svg paths - that is, piecewise linear paths consisting of only "m, h, v, l, z" elements and commas between coordinates replaced by spaces. See states_boundary.map for an example.data_input.dat
contains the data of the weight, one line per region. Regions with zero weight are ignorednum_rounds
is the number of rounds to run the region relaxation for. I usually take around 10K rounds, and it stops earlier if every state is resized to 1% accuracymap_output.dat
is the output file which can be easily processed by gnuplot, withx y region_id
per line and a blank line between two subregions
Sample images can be generated by running
bash process.sh
This step requires gnuplot and imagemagick (convert) to be callable directly.
- The map data for India was created based on Rajesh Odayanchal's map on Wikimedia Commons
- Thanks to Samhan Salahuddin for ideas and discussions