James Cheshire’s Population Lines redone with d3. Data from NASA. Fullscreen and code.
Originally I wanted to use the population map as a template for exploring different ways of transitioning data with d3. With delays and durations, a variety of vertical and horizontal sweeping effects can be created. Unfortunately, it isn’t possible to simultaneously animate hundreds of line elements smoothly. Lars Kotthoff’s variable width line generator did help cut down on the thousands of elements I started with - at first, the darker lines representing higher populations were formed by separating each longitude into a series of low and high segments - and with staggering, only a few dozen at a time are animated in the finished version.
Aesthetically, I was really drawn towards Cheshire’s use of light and dark lines. A simple coloring rule makes China look like the cover of Unknown Pleasures and parts of South America like a map of Mordor.
Functionally, having two colors representing high and low density makes it easy to compare different areas. Outside of the Sahara, for example, most of Africa is more populated than the western interior of the US. If I had more time, I would have made the density dividing point adjustable so the map could show where/how many people lived at various densities.
Using a polylinear scale to convert population to line height, I created another threshold effect:
populationToHeight = d3.scale.linear() .domain([0, 1, d3.max(d3.merge(longitudes))]) .range([0, -1, -180])
Segments with a population of 0 have a height of 0. Segments with a population of 1 or more have a height between 1 and 180, with each additional person adding significantly less than 1 pixel of height. Since essentially all land is inhabited, even sparsely populated coasts get a nice bevel differentiating them from the ocean. Greenland’s ice sheet is also clearly shown.
I’m not totally satisfied with the tooltip. Making the size of the highlighted area adjustable would make insights like the popular ‘half of humanity lives in this circle’ map discoverable. I also wish the size of the bars corresponded to the absolute number of people highlighted to make comparison between areas easier. Using a log scale common to all regions made at a glance comparisons between regions easier but obscured change over time. Plotting percentage change as a line on top of log scaled bars would achieve both goals; however that would require multiple axes which would significantly detract from the simplicity of the rest of the display.