Better Palettes

Earlier this week, we were treated to some lovely unadulterated* sciency data, in the shape of a map of sea level rise in the last 18 years. The story got good coverage  in the mainstream media, and an old friend of mine even got quoted on the BBC. Great.

The reaction on twitter however, often ran along the lines of “nice map, shame about the colour scheme”. One person even said something like “it’s a bit vomity”.

That sounds like a challenge, and here at Better Figures, vomity just will not do. To be fair, that particular colour scheme is widely used in climate science, as one of the defaults in a rather widely used programming language.

I humbly present a number of new versions of a sea level trend map. Which one do you prefer?

The data are from a different source, but show a very similar thing: satellite measurements of the trend in sea level over the last 19 years. I’ve plotted everything in R, using palettes created by these smart people at Penn State. The palettes are available in the RColorBrewer package. The R package fields from UCAR is also pretty useful here. I haven’t got a pretty digital terrain map, so land is white. I’m afraid I’ve wrapped the globe from 0-360 degrees longitude, to save time.

The palette should be diverging – that is, zero is in the middle. A grey scale doesn’t work in this case, as you wouldn’t be able to tell very positive from very negative. To get zero in the middle, I’ve had to cut off some of the highly positive values. This is a choice that highlights one particular feature (the overall positive nature of the data), but de-emphasises the extreme high values.

Here is a near recreation of the original map, in the default setting from the fields package, tim.colors:

We can get a bit more subtle, easing the impact on the eye with  the ‘Spectral’ palette.

Blues and reds work better than greens and reds,  if you want to make sure that the colour blind can read your plots. This one goes through yellow as a zero.

Ed Hawkins suggested blue to red through white. I like this one, but we reserve white for “more uncertain” in some of our other work.

Brown through teal is usually reserved for dryer/wetter.

I think the black-to-red palette has a certain elegance.

I couldn’t bring myself to do a purple-through-orange plot. You can do it if you like, by amending the R code that generated these plots. Good luck with that.

Your comments, suggestions and criticisms welcome, as always.

UPDATE 2012-09-27

OK, for curiosity’s sake, and after reading some of the resources provided by Mark Brandon in the comments, here are the rest of the diverging palettes from RColorBrewer

The advice is, “if you must use green, pair it with magenta”. Might work without the reverse, this one.

No, adding a liberal dash of purple doesn’t really help. Move along.

Ah, I take it all back. The purple to orange/brown works for me, anyway. Anyone else?

About these ads

26 comments

  1. They all look better for having a pale/neutral colour for zero. I think the red to blue through yellow (third one down) looks best.

  2. Isn’t any palette starting from red to be read as “alarmist”? That is, wouldn’t it be reasonable to produce something like blue2grey. While purple2green is quite “vomity” or flashy it may de-emphasize some connotations. The same is (from my point of view) achieved by the brown2green palette (although I possibly would remove the rev() in your code). Sidenote: I’d choose divPalette from the fBasics package instead of the functionality of RcolorBrewer

    1. Adam H Sparks · · Reply

      Red == Alarmist probably depends on your cultural background.

  3. All much better than the original, but I don’t think that yellow is a good colour for zero. To me it looks ‘warm’, whereas zero should be a neutral colour. Grey perhaps if you want to save white for uncertain regions?
    Ed.

  4. * Ooh, forgot, I meant to say that it is aguable that unadulterated data doesn’t exist.

  5. Yeah, I agree with you on grey as a neutral colour Ed. In fact, I think RColorBrewer might do this, if you choose the right number of colours to have in the palette.

  6. You say brown/teal generally reserved for wetter/drier, but terrestrial topographic maps tend to be green through brown. Personally I would probably associate a dark blue with deeper water and green with shallower, so maybe 2 colours with varying intensity fading to off-white near zero?

  7. OK…. So I think I was one of the people who criticized the colours…. So why did I? I thought in the original you couldnt actually distinguish much in the high (and low) value ranges.
    On that basis nearly all of the options you have posted are an improvement.

    But I also said that accessibility was an issue too.

    If you print the pic in B+W you get dark colours at either end of the spectrum. So what about this link from an EOS paper a few years ago…

    http://geography.uoregon.edu/datagraphics/EOS/index.htm

    And the colour schemes are http://geography.uoregon.edu/datagraphics/color_scales.htm

    Some show a full range when printed in B+W and also can be seen by people with colour perception difficulties.

    My fav is the green to magenta http://geography.uoregon.edu/datagraphics/color/GrMg_16.png

    M

  8. Great, thanks Mark. With the text files supplied here we should be able to get these into R pretty sharpish.

  9. I use a lot of the uoregon colour scales for the anomaly maps in state of the climate reports and so this discussion is very useful for me. I don’t doubt that I could do better but there is a balance between better and year-to-year consistency. Anyway here is a list of the colour schemes and variables:

    blue to dark red for cold to warm temperature,
    blue to black for clear to cloudy sky cloudiness,
    brown to blue for dry to wet water related variables (humidity, total column water vapour, precip, soil moisture, groundwater storage),
    blue to orange red for low/still to high/windy circulation variables of pressure/wind (perhaps this should be flipped such that red coincides with low pressure/higher wind speeds?),
    blue to dark orange for low to high ozone and low to high biomass burning,
    dark orange to blue for low to high surface albedo and low to high FAPAR.

    I’m open to suggestions on these – I thought they were intuitive at the time but that was three years ago.

    I did try green to magenta a few times but felt a bit like my retina may burn out. I’m sure I could have balanced it a bit better by playing with the gradations.

  10. Of these, I prefer the blue/red palette. As Ed pointed out, yellow is perceived as a warm color, and is likely to be grouped in with positive differences. Brown-green is too arbitrary, and red (or any other color) draws the eye more than gray, even at equal lightnesses.

    Unfortunately, the University of Oregon palettes are calculated in RGB space, not a perceptually-based space like CIE Luv (lightness, saturation, value). So the positive and negative steps aren’t always equivalent. In addition to the Color Brewer palettes (derived from the Munsell color system), I also use the NASA Ames color tool: http://colorusage.arc.nasa.gov/ColorTool.php for work on the NASA Earth Observatory. These blue-green-white-orange-red palettes were derived with the Ames tool: http://earthobservatory.nasa.gov/IOTD/view.php?id=77828

    The BBC map has some additional problems (the Aral Sea has *not* risen in the past 20 years), but that’s a topic for another day.

  11. Slightly different question – what would people recommend for a continuous colour scale – i.e. wrapping around on itself, e.g. for plotting mean wind direction as a colour?
    cheers,
    Ed.

    1. Surely red from the South and blue fom the North, Ed? Er, apart from in the Southern hemisphere of course ;)

  12. Gareth S Jones · · Reply

    Really good to see a choice of different map colour schemes – its great to have a choice. I might be alone though as I still prefer the original scheme. I think it is prettier and shows where the biggest changes are more clearly than the other color schemes.

    I suspect the colour scheme was chosen in the original plot to grab peoples attention – why have land orography otherwise.
    However whilst the other colour schemes have their advantages t would be a bit naive to expect the media to show the more bland looking figures – its rare they show science figures at all. So do you make it bold and correct and gets seen or bland and correct but not seen?

    Accessibility is the important issue however, and I would have hoped the makers of the original map thought more about that.

    Maybe the way forward is if online articles could allow the reader to choose the scheme they prefer= everyone is happy!

  13. Hi Doug

    First of all, this is a great post and discussion, it is good to see efforts to move away from the rainbow color palette. I am writing a whole blog series on the subject, and will share a number of alternative, more perceptual palettes. You can find the series in here:

    http://mycarta.wordpress.com/2012/05/29/the-rainbow-is-dead-long-live-the-rainbow-series-outline/

    As far as the versions you presented I am 100% with you: the red-white-black is aesthetically very pleasing, but my top preference goes to the purple-white-orange. I wrote a blog post on a very similar palette, and tested its effectiveness for color deficient viewers in here:

    http://mycarta.wordpress.com/2012/03/15/a-good-divergent-color-palette-for-matlab/

    The palette is based on the same EOS paper that Mark referenced.

    There are some other great palettes in this note by researchers at the IBM visualization center:

    http://www.research.ibm.com/people/l/lloydt/color/color.HTM

    I like the perceptual palette used in the top row of Figure 6, and also the yellow-gray-blue in the forth row, which in fact I think is one of the best divergent color palettes of all.

  14. Reblogged this on MyCarta.

  15. Andy Heaps · · Reply

    I’m glad to see the movement away from lots of colours to a reduced set. I generally advise students to go for 16 or less as this gives clarity to the plot. All of the colour scale suggestions from Ed’s downwards are nice and clear to me. It seems to me that this is more a case of personal preference as long as you aren’t excluding people who have colour perception difficulties. Deuteranope, for example, is quite common in males who may make up a large proportion of your audience. Vischeck is a good site for checking out your colour scales on a plot as you can see how it would look to someone with some sort of colour deficiency.

    http://www.vischeck.com/vischeck/vischeckImage.php

    As this is a discussion of the clarity of graphics in climate science I’d like to raise a couple of my pet dislikes of the plots above:

    1) Poor colour bar labelling. I look at the plots and get an indication that +/- 1 are indicated by white. Is this the case? Well, I’m not really sure as when I look down the plot the length of the colour blocks varies. Each colour block should be of the same length and should be labelled at the junction of the colours to avoid ambiguity. In this case I’d have two blocks of white labelled -1, 0, 1 at the junctions.

    2) No axis labels on any of the plots. If I’m interested in what’s happening along the equator or at 30N for example how do I know where they are? I have a rough idea but this is the whole point of putting properly labelled axes on plots. I can put a ruler across the plot and see exactly my point of interest. If you are labelling colour contour plots then make the tick labels face out or it is difficult to see where they are.

  16. “I think it is prettier and shows where the biggest changes are more clearly than the other color schemes.”

    Some of that detail is illusory: the sharp transitions between green/yellow and yellow/red act as contours. Your eyes will perceive detail even when there is a continuos transition. You can see the effect by just looking at the palette itself.

    “I’m glad to see the movement away from lots of colours to a reduced set. I generally advise students to go for 16 or less as this gives clarity to the plot.”

    I tend to prefer using a smooth palette, since having discrete colors leads to hard edges that may overemphasize those transitions. As a rule of thumb, if the goal is to allow quantitative analysis, use a small number of colors. If you want to show patterns in a dataset, use a smooth color scale scale. However, I haven’t seen any research on which is better.

    1. @Robert: I could not agree more about the illusory transitions in the rainbow. I discuss what causes those transitions in this post:

      http://mycarta.wordpress.com/2012/05/12/the-rainbow-is-dead-long-live-the-rainbow-part-1/

      In there you can find Matlab code to test any color palette for petcepual ordering and smoothness.

      @Andy: great point about color deficiency and Vischeck. I show simulations done with Vischeck of how the purple-white-orange palette is seen by the three type of color deficient viewers in this post:

      http://mycarta.wordpress.com/2012/03/15/a-good-divergent-color-palette-for-matlab/

      I also demonstrate why the rainbow palette is a very poor choice from the point of view of color deficient vision here:

      http://mycarta.wordpress.com/2012/05/28/the-rainbow-is-dead-long-live-the-rainbow-part-2-a-rainbow-puzzle/

  17. I’d like to know the explanation for the localised anomalies seen around southern africa….. -12mm right next to +12mm – is this the result of apparently stationary atmospheric anomalies, or just dodgy data?

    1. That’s an interesting question. I’d guess it’s something to do with ocean currents – you can see the same thing around the gulf stream. Oceanography experts?

      1. Changes in ocean currents also mean changes in ocean height. You can see this around the Gulf Stream and the Kuroshio as well. These must be quite persistent, or very strong mesoscale eddies, in order to show up on a 19 year composite.

  18. dmckgbear · · Reply

    There are examples here of a good principle: use divergent colors with continuous data that start negative and go positive. And examples of how to violate it, with the rainbow popsicle “spectral” colors that you say are the default in climate packages. These latter create false breaks between colors, e.g., green to yellow, yellow to orange, etc., and the worst ones wrap around the prism so that violet goes to red. Bad cartography.

  19. […] Considering different colour scales for sea-level change maps: Better palettes […]

  20. […] Considering different colour scales for sea-level change maps: Better palettes […]

  21. […] Considering different colour scales for sea-level change maps: Better palettes […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: