Non-Contiguous Cartogram
Inspired by Zachary Johnson. Non-continguous cartogram design invented by Judy Olsen. Albers projection derived from work by Tom Carden. U.S. state and county boundaries from the U.S. Census Bureau, simplified using GDAL and MapShaper.
Source Code
1 // Ratio of Obese (BMI >= 30) in U.S. Adults, CDC 2008
2 var data = [
3 , .187, .198, , .133, .175, .151, , .1, .125, .171, , .172, .133, , .108,
4 .142, .167, .201, .175, .159, .169, .177, .141, .163, .117, .182, .153, .195,
5 .189, .134, .163, .133, .151, .145, .13, .139, .169, .164, .175, .135, .152,
6 .169, , .132, .167, .139, .184, .159, .14, .146, .157, , .139, .183, .16, .143
7 ];
8
9 var svg = d3.select("#chart").append("svg:svg")
10 .attr("width", 960)
11 .attr("height", 500);
12
13 d3.json("../data/us-states.json", function(json) {
14 var path = d3.geo.path();
15
16 // A thick black stroke for the exterior.
17 svg.append("svg:g")
18 .attr("class", "black")
19 .selectAll("path")
20 .data(json.features)
21 .enter().append("svg:path")
22 .attr("d", path);
23
24 // A white overlay to hide interior black strokes.
25 svg.append("svg:g")
26 .attr("class", "white")
27 .selectAll("path")
28 .data(json.features)
29 .enter().append("svg:path")
30 .attr("d", path);
31
32 // The polygons, scaled!
33 svg.append("svg:g")
34 .attr("class", "grey")
35 .selectAll("path")
36 .data(json.features)
37 .enter().append("svg:path")
38 .attr("transform", function(d) {
39 var centroid = path.centroid(d),
40 x = centroid[0],
41 y = centroid[1];
42 return "translate(" + x + "," + y + ")"
43 + "scale(" + Math.sqrt(data[+d.id] * 5 || 0) + ")"
44 + "translate(" + -x + "," + -y + ")";
45 })
46 .style("stroke-width", function(d) {
47 return 1 / Math.sqrt(data[+d.id] * 5);
48 })
49 .attr("d", path);
50
51 });