Skip to content

Instantly share code, notes, and snippets.

@RogerNoble
Last active December 17, 2015 09:49
Show Gist options
  • Save RogerNoble/5589964 to your computer and use it in GitHub Desktop.
Save RogerNoble/5589964 to your computer and use it in GitHub Desktop.
Population of Australia by Statistical Area Level 4 (SA4)
region_id Tot_P_P
101 207822
102 312184
103 196742
104 130604
105 113591
106 243246
107 275983
108 201110
109 110317
110 176194
111 342605
112 227619
113 150120
114 137007
115 210413
116 303528
117 264544
118 249546
119 523608
120 263560
121 374665
122 237640
123 235804
124 288188
125 394708
126 162845
127 360166
128 210267
197 112
199 12918
201 146235
202 140696
203 250651
204 159294
205 255858
206 501990
207 340005
208 378215
209 437046
210 318483
211 479103
212 658016
213 616058
214 271064
215 147428
216 124894
217 120659
297 36
299 8308
301 211433
302 191047
303 314085
304 170353
305 223976
306 224436
307 122273
308 211344
309 507642
310 281790
311 290430
312 166811
313 215454
314 167430
315 82923
316 306909
317 140220
318 217897
319 273267
397 472
399 12545
401 277064
402 391643
403 339874
404 216655
405 106519
406 84619
407 177122
497 5
499 3068
501 158104
502 83294
503 156351
504 219896
505 482955
506 433626
507 352747
508 215048
509 129438
597 415
599 7297
601 211656
602 137558
603 35797
604 109152
697 115
699 1073
701 120586
702 89377
797 110
799 1870
801 356586
897 0
899 632
901 3001
997 3
999 25

Population of Australia by Statistical Area Level 4 (SA4). Data sourced from the Australian Bureau of Statistics data packs.

<!DOCTYPE html>
<meta charset="utf-8">
<style>
.q0-9 { fill:#E0ECF4; }
.q1-9 { fill:#9EBCDA; }
.q2-9 { fill:#8C6BB1; }
.q3-9 { fill:#8C6BB1; }
.q4-9 { fill:#810F7C; }
.q5-9 { fill:#4D004B; }
.q6-9 { fill:#AE017E; }
.q7-9 { fill:#7A0177; }
.q8-9 { fill:#49006A; }
.sa4 { stroke:#FFFFFF; stroke-width: 1px; }
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/queue.v1.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script>
var width = 960,
height = 1160;
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var projection = d3.geo.conicEqualArea()
.parallels([-18, 0])
.rotate([-140, 0])
.center([0, -136])
.scale(1000)
.translate([width / 2, height / 2]),
path = d3.geo.path()
.projection(projection),
valueById = d3.map(),
quantize = d3.scale.quantize()
.domain([0, 658016])
.range(d3.range(5).map(function(i) { return "q" + i + "-9"; }));
queue()
.defer(d3.json, 'sa4.json')
.defer(d3.csv, '2011-b01-sa4.csv', function(d) { valueById.set(d.region_id, +d.Tot_P_P); })
.await(ready);
function ready(error, sa4){
var states = topojson.feature(sa4, sa4.objects['sa4-geo']);
svg.append("path")
.datum(states)
.attr("d", path);
svg.selectAll(".subunit")
.data(states.features)
.enter().append("path")
.attr("id", function(d) { return "sa4-" + d.id; })
.attr("class", function(d) { return quantize(valueById.get(d.id)) + ' sa4'; })
.attr("d", path);
}
</script>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment