-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelcoll.gplt
executable file
·64 lines (57 loc) · 2.09 KB
/
elcoll.gplt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/gnuplot
#
#code pop rep_actual reps_deserved rep_excess pop_2018 deserved_2018 excess_2018
#CA 37341989 53 52.5376 0.462376 39557045 52.5948 0.40517
#TX 25268418 36 35.5509 0.449062 28701845 38.1618 -2.16182
#NY 19421055 27 27.3241 -0.324099 19542209 25.9832 1.01679
set term qt size 1200,800 font ',12'
set title 'Cong Reps by State 2010'
set grid
set ylabel "Reps"
#set logscale y
#set border 2+1
set tics nomirror
unset xtics
stats 'elcoll.gpdat' using 2 name 'pop' noout
stats 'elcoll.gpdat' using 3 name 'reps' noout
stats 'elcoll.gpdat' using 8 name 'excess' noout
ymin = excess_min
ymax = excess_max
off = 0.1*(abs(ymax) + abs(ymin))
xmax = pop_records
set xrange [0:xmax+1]
set multiplot layout 2,1
set bmargin at screen 0.26
plot 'elcoll.gpdat' using ($0):($3) w boxes fill transparent pattern 4 lc 15 title "Reps", \
'' u ($0):($4) w boxes fill transparent pattern 5 lc 11 title "Deserved", \
'' u ($0):(($3>$4 ? $3 : $4)+.5):1 w labels font ',10' offset 0,0.3 notitle
set tmargin at screen 0.22
set bmargin at screen 0.03
set notitle
set ylabel 'Excess'
set yrange [-2.7:2.7]
plot 'elcoll.gpdat' using ($0):($5) w boxes fill solid 0.25 border -1 notitle, \
'' u($0):(($5>0 ? ($5)+off : ($5)-off)):1 w labels font ',10' notitle
#unset multiplot
#
pause -1 "Hit return to continue--"
##
## try different fill pattern and colors
##
#set title 'Cong Reps by State 2018'
set multiplot layout 2,1
set bmargin at screen 0.26
set yrange [*:*]
set ylabel "Reps"
plot 'elcoll.gpdat' using ($0):($3) w boxes fill transparent solid 0.15 lc 7 title "Reps", \
'' u ($0):($4) w boxes fill transparent solid 0.35 lc 3 title "Deserved", \
'' u ($0):(($3>$4 ? $3 : $4)+.5):1 w labels font ',10' offset 0,0.3 notitle
set tmargin at screen 0.22
set bmargin at screen 0.03
set notitle
set ylabel 'Excess'
set yrange [-2.7:2.7]
plot 'elcoll.gpdat' using ($0):($5) w boxes fill solid 0.25 lc 2 notitle, \
'' u($0):(($5>0 ? ($5)+off : ($5)-off)):1 w labels font ',10' notitle
unset multiplot
pause -1 "Hit return to continue--"