# Evidence on red-purple-blue graphs

For some reason I have seen a preponderance of graphs whose color schemes (to represent a continuous variable) transition from red through purple to blue. Here is but one example (from a blog post, but I've seen plenty of published examples):

Personally, I find it impossible to clearly associate the color change with an increase in magnitude of the plotted variable, but I realize color is by its nature subjective and the very fact that I've seen it so much makes me suspect that there's a reason for that.

Is there a clear consensus on red-purple-blue transitions in the literature?

• My guess is that it is a simple interpolation from (0,0,255) to (255,0,0) in RGB colorspace (so Magenta (255,0,255) is somewhere in the middle). Likely not recommended for a sequential nor a diverging color scheme! See the work of Cynthia Brewer and her colorbrewer app for reference. – Andy W Jul 10 '12 at 2:11
• When you're avoiding red-green-yellow distinctions to accommodate the approximately 6% of western males (and 1% of western females) with some form of red-green color blindness, there are not too many other choices left! (I prefer blue-yellow scales to blue-red scales, but often shades of yellow do not render reliably or reproduce well.) – whuber Jul 10 '12 at 13:06
• @whuber Ah, that may explain its prevalence (at least in my life) :-). Thanks. – Ari B. Friedman Jul 10 '12 at 20:47

To elaborate on my comment above, my suspicion was partly confirmed by the code posted to create the above cited graph at the knowledge discovery blog. Do you perhaps see many of these examples utilizing ggplot2 graphics? It appears the default for scale_color_gradient is blue to red. It appears to me to be a default interpolation along LAB color space as oppossed to RGB (so I'm not sure as to the exact transformation), but the result appears pretty similar. Below is an example in R for varyious mixing of Red and Blue while holding green at a constant 0.

red <- rep(seq(15,255,15),16)
blue <- rep(seq(15,255,15), each = 16)
color <- rgb(red = red, green = 0, blue = blue, maxColorValue = 255)
plot(x = red, y = blue, col = color, pch = 19, cex = 3)


To elaborate on why this is a bad choice (as is written on the help(scale_color_gradient) page) for sequential color scales (i.e. from low to high) you typically want to keep hue constant and vary chroma and luminance (where chroma and luminance are defined in the Munsell color scale). Or, more straightforward, people don't typically interpret varying hues as either higher or lower value, but people can typically associate darker or lighter colors on an ordinal scale.

A blue to red interpolation like this might be defensible choice for a diverging color scheme, but typically we want more contrast between the shades. See the scale_gradient2 help page for some examples. So, in line with gestalt principles of visual perception, I would suggest rewriting the plot cited as below;

(p + geom_point(aes(x = month, y = year, size = Value, colour = VIX),shape=16, alpha=0.80) +
scale_colour_gradient(limits = c(10, 60), low="red", high="black", breaks= seq(10, 60, by = 10))  +
scale_x_continuous(breaks = 1:12, labels=c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) +
scale_y_continuous(trans = "reverse") +
theme_bw() + opts(panel.grid.minor=theme_blank(), panel.grid.major=theme_blank())
)


This is certainly a difficult visual task, as the small dots need some color to be able to distinguish them between and the background (I removed the gridlines and grey background to provide more contrast). Other graphical options may be to scale the points so the smallest points are slightly larger and utilize an outline so they are more obviously distinguished from the background. But, IMO, a more fruitful approach is not via the heatmap, but by sprucing up the line plot (see a similar discussion on birthdays by day of year by Andrew Gelman).

(p + geom_line(aes(x = Date, y = Value), alpha = 0.2) +
geom_point(aes(x=Date, y=Value, size=VIX), shape=1)
)


For other references on utilizing color in plots I would highly suggest the work of the cartographer Cynthia Brewer. Her ColorBrewer scales are widely implemented and are becoming a defacto standard for generating color scales.

• Thanks for that and for the reference to Brewer. I was aware of ColorBrewer but not that she was an academic. Currently downloading some of her articles to read. – Ari B. Friedman Jul 10 '12 at 20:48