Bill & Melinda Gates Foundation
We used the power of R to design a series of snappy, sharable animated charts that promoted the progress against stunting in sub-Saharan Africa.
Child stunting is one of the most powerful, and complex, measures in global health.
IHME asked us to help promote stunting progress within Africa with a series of animated maps that could be showcased as attention-grabbing social media posts.
We had stunting data for three sub-Saharan countries: Burkina Faso, Ghana and Senegal.
The big challenge here was to create, iterate and repeat a series of choropleth maps for these countries in a very short timeframe. So we planned to do as much data wrangling and plotting in code as possible.
Many languages could have helped us here, but for this project we used R.
Along with the stunting data, we could get spatial data (longitudes and latitudes) for each of these three countries and their regions, thanks to R’s raster package. What we now needed to do was join the two together.
First we used R’s tidyverse packages to select just the columns that we needed (region, year and prevalence of stunting) and then split the dataset out into one for each country.
Next, using the rgeos and maptools packages, we converted each country’s spatial data into a table format. Our (near) final step was simply joining these two datasets for each country, using their shared set of region names.
Shout-out to Thilo Klein for his super-helpful blog post on all of this.
As you might expect, inconsistencies in the spellings of the regions led to some very bizarre looking Senegal’s at first.
But once all the st louis’ had become St-Louis’s and so on, we were away!
With our code working properly, we could now quickly and easily test different colour scales and animation speeds.
We also made the minimum and maximum values of the colour scales consistent across each of the maps, so they could be compared with one another.
With these fundamentals in place, we exported our animations as gif files, ready to be styled up in Illustrator.
From here, it was just a case of adding a helpful key and titles to make the maps effortless to understand at a glance.
Designed to be simple and striking in people’s social feeds, the maps gave IHME and the Bill & Melinda Gates Foundation a compelling way to grab people’s attention and drive them to explore the interactive tool.