Site icon R-bloggers

Cindy Brewer: helping you choose better color scales for maps

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The choice of colors you use in a statistical graphic isn't just about making your chart look good: the colors you choose are often critical to interpretation. For example, you wouldn't want to use a scale like this to represent, say, average income on a map:

That palette would be suitable for qualitative data without implicit ordering (say, political parties), but for a continuous variable the viewer has no reason to assume that "pink" should be more than "orange". Even when choosing a continuous scale, the colors you use may have cultural meanings (imagine a map of temperatures with "hot" represented by blue shades and "cold" represented by red). Still, bad color choices happen all the time.

One person who has done more than most to promote good practices in color use is the cartographer Cindy Brewer, who was recently the subject of a feature article in Wired. Her ColorBrewer2 website helps you choose the appropriate color scale for you map depending on your data type: qualitative, sequential or diverging (with a neutral color between two extremes). It can even give you colorblind-safe and print-friendly options.

For R users, RColorBrewer package make it easy to use such palettes in R charts. After loading the package, you can see the palettes you have to choose from with the display.brewer.all() function:

You can use the function brewer.pal to select one of these palettes with any number of colors with the function brewer.pal. (Sadly, it does not provide an option to create colorblindness-friendly palettes.) And if you're a ggplot2 user, you can use the scale_brewer option to use a ColorBrewer palette.

On the other hand, if you're chart is more whimsical than scientific, there's always the Wes Anderson palettes. 

Wired: The Cartographer Who’s Transforming Map Design (via Trevor A. Branch)

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.