Population density in cities, portrayed more vividly
D3/OJS
Published
March 29, 2023
Manila is the densest city on Earth,1 fitting 1.8 million people into a 43 square-kilometer crucible. The 16 other cities that constitute Metro Manila, the Philippine capital, are extraordinarily crowded as well, resulting in an overall density of 22,000/km². This is twice that of New York and almost three times that of Singapore. Dysfunctional urban planning has failed to cope. Suburbs-style neighborhoods and private golf courses sprawl incongruously in city centers while open green spaces remain limited. The state of transportationisdystopian. A much needed subway intended for partial operability in 2022 only started construction last January.
Living in such a crowded place means shoving, squeezing, and cartwheeling your way through the chaos of gridlocked streets and packed trains, a daily collision of body against body that brings to mind Radiohead at their most anxious: “everyone is sonear”. It’s an experience that isn’t quite captured by the metric “22,000/km²”. I wanted to make this number more evocative through a visualization, but how? I’ve seen population density plotted on bar charts, on choropleth maps, even on a 3D histogram, but none of these, I feel, do justice to the absolute pressure cooker that is Manila.
I decided to try something novel. I call it a particles chart, and it consists of a D3 force simulation of balls bouncing off each other in a box. It’s relatively simple to construct — I am indebted to Vasco Asturiano’s modules in particular — yet it captures so effectively what “densest city on the planet” means. It means countless agitated bodies jockeying and jittering in a tight space, searching endlessly for room to breathe.2
Code
html` <div class="ojs-title">Fancy bumping into you</div> <div class="ojs-subtitle">Population density in Metro Manila and major global cities</div>`viewof citySelectPH = Inputs.select( d3.group(densityManila, d => d.city), {label:"Pick a Metro Manila city...",key:"Manila",description:"Pick a Metro Manila city..." })viewof citySelect = Inputs.select( d3.group(densityOthers, d => d.city), {label:"...and compare with a global city",key:"New York" }){const container = d3.create("div");const containerLegend = container.append("div").attr("style","display: flex; justify-content: center"); containerLegend.call(legend);const containerChart = container.append("div").attr("style","display: flex; gap: 1em; justify-content: space-between"); containerChart.call(particles, citySelectPH); containerChart.call(particles, citySelect);return container.node();}html`<div class="ojs-caption">Each box is a square kilometer. Each dot is 100 people. "Ancestors" date from 1500 CE, as derived from Putterman and Weil's <a href="https://sites.google.com/brown.edu/louis-putterman/world-migration-matrix-1500-2000" target="_blank">World Migration Matrix</a>.</div>`
I’ve set the balls to generate at various sizes, reflecting the fact that some people take up more space than others. Think private vehicles versus public transport, detached homes versus high-rise condominiums. The balls are also colored in proportion to ethnic makeup, as recorded in Putterman and Weil’s World Migration Matrix. I’ve written about this dataset here and here, but to recap, the matrix breaks down a country’s population according to where their ancestors were in the year 1500. Migrant ancestor balls are colored by originating continent, ordered from largest to smallest shares.
To be clear, density is not inherently bad. In fact, density is indicative of a successful city since it means people want to move there. Density itself also confers benefits through agglomeration effects: proximity among firms and laborers brings down production costs and increases knowledge spillovers. But these benefits surely fall short of potential in Metro Manila. How great can proximity advantages be if it takes two hours to get anywhere? If there were an optimal level of density for a given level of infrastructure quality, Manila has blown way past it.
The particles chart can be used in any number of applications, with three levers (the number, colors, and sizes of the particles) available for mapping to variables. I’ll end this post with an additional example, this time tackling a different aspect of modern city living. It’s not a statistic, but a feeling. The kind that creeps up on you late at night under certain moods, when the veil lifts and you momentarily perceive the Camusian absurdity of all your life’s endeavors. A feeling best encapsulated, I think, by another song lyric:
Other sources may differ depending on how city boundaries are defined.↩︎
City density data were taken from Wikipedia. Comparisons are only suggestive given idiosyncrasies in how administrative boundaries are defined. For example, Metro Manila is 624 km², comparable to Jakarta (664 km²) and New York (778 km²) but not so much to Paris (105 km²) and Beijing (16,411 km²).↩︎