Skip to content

Commit 63422df

Browse files
committed
First commit
0 parents  commit 63422df

12 files changed

+664
-0
lines changed

data/LSseats.dat

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
25
2+
2
3+
14
4+
40
5+
11
6+
2
7+
26
8+
10
9+
4
10+
6
11+
14
12+
28
13+
20
14+
29
15+
48
16+
2
17+
2
18+
1
19+
1
20+
7
21+
21
22+
13
23+
25
24+
1
25+
39
26+
17
27+
2
28+
5
29+
80
30+
42

data/covidcases.dat

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
1542079
2+
23159
3+
359640
4+
681199
5+
941366
6+
143192
7+
780471
8+
728607
9+
175384
10+
280930
11+
324884
12+
2367742
13+
2293633
14+
757119
15+
5527092
16+
42565
17+
27755
18+
9732
19+
19593
20+
1412959
21+
668422
22+
528676
23+
903418
24+
12527
25+
1770988
26+
547727
27+
44356
28+
307566
29+
1659212
30+
1229805

data/coviddeaths.dat

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
9904
2+
89
3+
2588
4+
4339
5+
12391
6+
2302
7+
9469
8+
7317
9+
2638
10+
3637
11+
4714
12+
24207
13+
6995
14+
7394
15+
86618
16+
661
17+
414
18+
30
19+
258
20+
22831
21+
2483
22+
12888
23+
7475
24+
220
25+
19598
26+
3085
27+
452
28+
5600
29+
18760
30+
14054

data/gdp.dat

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
870849
2+
24511
3+
315881
4+
530363
5+
318101
6+
73170
7+
1502899
8+
704957
9+
149442
10+
160464
11+
297204
12+
1490624
13+
790302
14+
813820
15+
2579628
16+
27870
17+
33481
18+
22287
19+
28402
20+
750962
21+
487805
22+
525303
23+
921789
24+
28723
25+
1630208
26+
850596
27+
49845
28+
236768
29+
1584764
30+
1089898

data/names

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Andhra Pradesh
2+
Arunachal Pradesh
3+
Assam
4+
Bihar
5+
Chhattisgarh
6+
Goa
7+
Gujarat
8+
Haryana
9+
Himachal Pradesh
10+
Jammu and Kashmir
11+
Jharkhand
12+
Karnataka
13+
Kerala
14+
Madhya Pradesh
15+
Maharashtra
16+
Manipur
17+
Meghalaya
18+
Mizoram
19+
Nagaland
20+
NCT of Delhi
21+
Odisha
22+
Punjab
23+
Rajasthan
24+
Sikkim
25+
Tamil Nadu
26+
Telangana
27+
Tripura
28+
Uttarakhand
29+
Uttar Pradesh
30+
West Bengal

data/popincrease.dat

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
4476918
2+
284283
3+
4530672
4+
20924720
5+
4705666
6+
108823
7+
9786428
8+
4669191
9+
779056
10+
2478626
11+
6042064
12+
8395718
13+
1548677
14+
12212475
15+
15620472
16+
427276
17+
657467
18+
201324
19+
0
20+
2901732
21+
5239458
22+
3415106
23+
12147712
24+
65786
25+
10027568
26+
4185155
27+
479152
28+
1627652
29+
33527877
30+
11126436

data/population.dat

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
49577103
2+
1383727
3+
31205576
4+
104099452
5+
25545198
6+
1458545
7+
60439692
8+
25351462
9+
6864602
10+
12541102
11+
32988134
12+
61095297
13+
33406061
14+
72626809
15+
112374333
16+
2570390
17+
2966889
18+
1097206
19+
1978502
20+
16787941
21+
41974219
22+
27743338
23+
68548437
24+
610577
25+
72147030
26+
35003674
27+
3673917
28+
10086292
29+
199812341
30+
91276115

plotter

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/gnuplot
2+
3+
N = 7;
4+
array names=[ "LSseats", "covidcases", "coviddeaths", "gdp", \
5+
"original", "popincrease", "population"]
6+
array titles=["Lok Sabha seats", "Confirmed COVID cases", "Covid deaths", \
7+
"GDP", "Area", "Increase in population (2001-11)", "Population"]
8+
9+
array cmap = ["#ca8282", "#caca82", "#82ca82", "#82caca", "#8282ca", "#ca82ca"]
10+
set for [i=1:6] linetype i lc rgb cmap[i]
11+
array colors=[1, 2, 3, 4, 6, 4, 1, 2, 3, 4, 5, 5, 1, 2, 3, \
12+
4, 5, 6, 1, 6, 3, 6, 5, 6, 3, 2, 5, 4, 1, 2]
13+
14+
set term svg enhanced size 800, 900
15+
set title font "Myriad Pro, 32"
16+
17+
do for[i=1:N] {
18+
file='data/processed/'.names[i].'.dat'
19+
stats file u 1 nooutput
20+
xmin=(i==1)?STATS_min:min(STATS_min,xmin)
21+
xmax=(i==1)?STATS_max:max(STATS_max,xmax)
22+
stats file u (-$2) nooutput
23+
ymin=(i==1)?STATS_min:min(STATS_min,ymin)
24+
ymax=(i==1)?STATS_max:max(STATS_max,ymax)
25+
}
26+
27+
unset border
28+
unset tics
29+
set xrange[xmin:xmax]
30+
set yrange[ymin:ymax]
31+
set size ratio -1
32+
33+
do for[i=1:N] {
34+
print ' '.names[i].'.svg'
35+
file='data/processed/'.names[i].'.dat'
36+
image='images/'.names[i].'.svg'
37+
pngimage='images/'.names[i].'.png'
38+
set title '{/:Bold '.titles[i].'}'
39+
set output image
40+
plot file u 1:(-$2):(colors[$3]) w filledcurves closed lc var notitle, \
41+
'' u 1:(-$2) w l lc 'black' lw 0.5 notitle
42+
set output
43+
}

process.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
mkdir -p images data/processed
4+
5+
cd data
6+
echo "Generating map data"
7+
echo "" original.dat
8+
echo ../states_boundary.dat population.dat 1 | ../../weighted_distort \
9+
> processed/original.dat 2>processed/log_original.dat
10+
11+
for i in *.dat
12+
do
13+
echo "" $i
14+
echo ../states_boundary.dat $i 10000 | ../../weighted_distort \
15+
> processed/$i 2>processed/log_$i
16+
done
17+
echo done
18+
echo ""
19+
20+
cd ..
21+
echo "Generating svg plots"
22+
gnuplot plotter
23+
echo done
24+
echo ""
25+
26+
echo "Generating png images"
27+
cd images
28+
for i in *.svg
29+
do
30+
echo "" "${i%.svg}.png"
31+
convert $i "${i%.svg}.png"
32+
done
33+
echo done

sample/area_population.png

195 KB
Loading

states_boundary.dat

+30
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)