Multi-color text in ggplot2

Occasionally when producing charts, it’s helpful to plot a single text element in multiple colors. Here’s an example of labels from the SDG Atlas where we used multiple colors to good effect to make labels for “Bangladesh” and “United States” clearer (I’ve darkened some parts of the chart to make the relevant labels clearer):



Making of: comparative treemaps

(or “the incredible shrinking treemap” HT @albertocairo).

Treemaps are a really useful way to understand hierarchical data, but they are not well-suited to side by side comparison.

Recently I’ve been working on the World Bank’s Atlas of the Sustainable Development Goals 2017 (which was a large team effort). One highlight that I worked on was a comparative treemap / cartogram of people living in extreme poverty, which is a bit different from the typical treemap.

Here’s one version, an animated GIF that Tariq Khokhar captured (you can see the interactive timeline here):