Spatial-Aggregation Explorer

an interactive experiment in 2D binning of earthquake records
—by Amelia McNamara and Aran Lunzer

This is a hands-on kind of page...

The map below shows a dot for each California location that recorded an earthquake (typically a small one) in 2014. Each cell in the grid overlaying the map is shaded according to how many of the dots it encompasses. Mouse over the map to explore it, using the operations listed below; the highlighted operations are ones that change the relationship between the cells and the map. Scroll beyond the map (you'll probably need to use the scroll bar!) to see some extra notes.

drag pan map, including cells
shift-drag move cell grid relative to map
option-drag rotate cell grid about map centre
mouse wheel zoom map, including cells
shift-mouse wheel zoom cells relative to map (sizes 0 to 8)
S or H Square/Hexagonal cells
space fade/unfade map
escape temporarily hide cells (while pressed)
E hide/unhide Empty cells' outlines

Why did we build this?

Since 2015 the two of us have been discussing the benefits and pitfalls of binning—in other words, of getting an overview of the distribution of values in some dataset by portioning it into bins. Our thoughts around binning with a single dimension led to our online essay about histograms. This page, by contrast, is based on our preliminary investigations of binning on two dimensions.

The two dimensions of the data items being considered here are latitude and longitude, which is what makes it convenient for us to show everything—the items, and the bins—overlaid on a map. Spatial statisticians refer to such aggregation as "upscaling,", and they take a keen interest in how the shapes of the cells, and the way the cells are aligned relative to the data, can lead to a variety of apparent distributions for the same underlying set of data points. That kind of variation is what we hope you saw as you adjusted the cell size and alignment on our earthquake map.

One specialized application of spatial binning is the division of voters among electoral districts. Manipulating the districts' boundaries to influence, for political gain, how the voters are grouped into these "bins" is the practice of gerrymandering, which dates back at least two hundred years but has recently come under renewed scrutiny. The Washington Post created a now-famous static graphic illustrating how gerrymandering works, and the topic has been addressed in game-like interactives such as The Redistricting Game and District. In April 2017, John Oliver included an informative segment on gerrymandering in his satirical news show.

Amelia's OpenVisConf 2017 talk How spatial polygons shape our world addresses a range of issues around spatial statistics, including gerrymandering. There are also additional references in the research note that we assembled as a status report on this project in 2016.

The general message that we want to get across is that binning, like many other forms of data summarization, is subject to choices. If someone presents an argument based on binned data, we need to understand whether that particular binning in fact gives a distorted view of the underlying reality. A responsible form of presentation would be one that—like this page—has facilities to let readers explore other binnings for themselves; we call on today's visualization-software builders to make such facilities the norm!

Getting at the code

The code that powers this interactive is available on GitHub if you'd like to try adapting it. We make no claims about its generalizability.

Contacting us

If you have comments or questions, or just want to say Hello, you can tweet at Amelia, @AmeliaMN, or email Aran, aran at acm dot org.