Elevation Tilemaps

Since a few years, I've been fascinated by cartograms and tilemaps and have written several blog posts about the topic. I think they are an interesting option for visualizing spatial data at an aggregate (e.g. county, state, region) level. According to Wiktionary, a tilemap is a «two-dimensional grid made up of rectangular tiles of equal size, each of which can display an image.» The way most data viz practicioners use the term, they relax the requirement that tiles are to be rectangular (there are, e.g., hexagon- and triangle-based tilemaps). And the «images» mentioned in the definition can instead be data visualizations such as line graphs, bar graphs, pie charts, et cetera. Here, I created some fun visualizations in order to demonstrate tilemaps – even custom-made ones – in R.

geofacet and the Geo Grid Designer

In R, I usually use the «tidyverse» set of packages, i.e., ggplot2 for visualizations. For making and using tilemaps, I use geofacet, which can be thought of as a kind of a spatial sibling of facet_wrap() and facet_grid() in ggplot2. The geofacet package has a nice introduction and some examples on GitHub.

If you would like to make custom grids for your tilemaps, geofacet has you covered: It offers a very nice browser-based visual editor for constructing grids. You simply start it in R using:

library(geofacet)
grid_design()

This opens the app “Geo Grid Designer” in which you can specify entities as well as their position:

Geo Grid Designer: This handy browser-based app is also part of the geofacet package

If you like, you can contribute your custom grid to the official geofacet collection. If you construct a custom grid using code in R and use it in a geofacet plot, the package will even ask you if you'd be willing to upload it as a user-contributed grid.

R-based Tilemaps

To show what can be achieved using R and geofacet, I have produced geofacetted slopegraphs of the minimum (in some cases: mean) and maximum elevations of each state or country, in the US, in Europe, and in Switzerland. These visualizations don’t have any deeper meaning, but they nicely show how tilemaps can abstract geography and visualize big patterns in data.

Minimum, mean, and maximum elevations per state in the US

Minimum and maximum elevations per country in Europe

Minimum, mean, and maximum elevations per canton in Switzerland

I have compiled a GitHub repository with code examples for all of the above visualizations (and a few more). Most of these are based on custom grids that I have created myself using geofacet’s Geo Grid Designer.