Earthquake Depth

Some visualisations of the depths of the recent New Zealand earthquakes.

David Friggens

There have been a number of interesting visualisations of this weeks earthquakes: I particularly like Chris McDowall’s, but also Harkanwal Singh’s. Most of them focus on the two-dimensional geographic dimensions, which is important. A notable exception is the pie graph showing that nearly half of the energy released by NZ earthquakes in seven years came on Monday.

I haven’t seen anything yet that gives a closer look at the depths of these earthquakes. The depth of the epicentre has an effect on the energy and damage at the surface, so this seems like an important factor. Some use colour to indicate depth, but it’s hard to get a feel for the distribution and variation. I thought it would be interesting to take a look at the quakes with depth as the primary dimension.

Geonet lets us search and download earthquake data.1

If depth is your primary dimension then you’re probably going to have to give up your standard 2d geography. I picked a line bisecting the South Island as well I could (manually chosen in Google Maps — nothing special about it) that could serve as a reasonable 1d projection.

Map of NZ with projection line shown
Map of NZ with projection line shown

With this we can plot (and animate) the depths. The quakes are plotted every hour, and faintly remain, to show the cumulative effect. It’s hard to get a realistic comparison of the magnitudes, given that it’s an exponential scale, so I’ve “highlighted” the larger ones in blue (>5M), green (>6M) and red (>7M).

Animated 1d map of earthquake depth
Animated 1d map of earthquake depth

Alternatively, we could look at depth against time.

Animated plot of depth against time
Animated plot of depth against time

In both these plots you can see that not much was happening on Sunday, but we started getting pummelled by quakes from midnight, Monday morning. (Two minutes past midnight, to be specific — I remember it well!) A few are quite deep down, but most — especially the big ones — are relatively shallow.

Code unlisting

The code for the animations can be found in the Rmd source in the repository, but gganimate has changed considerably since I made these so I wouldn’t use them as a guide.

  1. And provides excellent live notifications.


If you see mistakes or want to suggest changes, please create an issue on the source repository.


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".