Debian Codegraph @

addons/geoplot/examples/us-pop-density.inp

raw
1 set verbose off
2 include geoplot.gfn
3
4 open us-states.geojson --quiet --frompkg=geoplot
5 bundle b = bread($mapfile)
6
7 # Shrink Alaska and place underneath the "lower 48"
8 matrix shift = {34, -35}
9 matrix center = {-150.885, 62.5503}
10 matrix scale = {0.3, 0.35}
11 geoplot_translate_feature(&b, 48, shift, center, scale)
12
13 # Shift Hawaii alongside Alaska
14 shift = {51, 5}
15 geoplot_translate_feature(&b, 5, shift)
16
17 bwrite(b, "us-rearranged.geojson")
18 open us-rearranged.geojson
19
20 # read in some more data
21 join statepop.gdt population pop_density --ikey=postal --okey=Code
22 series people_per_sen = population / 2
23 # cut out D.C.
24 smpl postal != "DC" --restrict
25
26 # display map 1
27 bundle opts = _(title = "USA, population density", palette = "green-to-red")
28 opts.projection = "EPSG2163"
29 opts.logscale = 1
30 geoplot(pop_density, opts)
31
32 # display map 2
33 bundle opts = _(title = "People per US Senator")
34 opts.projection = "EPSG2163"
35 opts.palette = "blues"
36 geoplot(people_per_sen, opts)
37
38