Skip to content

Colormap that look good in gray scale

4 messages · thibert, Achim Zeileis, Greg Snow

#
Hi,
   I am looking for a colormap (in color) that look like a gradient in gray
scale. It is to allow people without color printer to print the color graph
and have something meaningful in gray scale. 

It can be something like this 
plot(1:6,col=c(1,7,5,3,2,4),pch=c(1,20,20,20,20,20))
but with an arbitrary number of different colors, not just six.

Thanks
#
On Wed, 4 Mar 2009, thibert wrote:

            
There is some discussion of this in our manuscript
   Achim Zeileis, Kurt Hornik, and Paul Murrell
   Escaping RGBland: Selecting colors for statistical graphics
which is forthcoming in CSDA (Computational Statistics & Data Analysis), 
for a preprint see
   http://statmath.wu-wien.ac.at/~zeileis/papers/Zeileis+Hornik+Murrell-2008.pdf

This discusses choice of the color, especially for shading areas. If you 
want to use this for shading points or lines, I would recommend to use 
relatively dark and colorful colors and different plotting characters.

R packages that provide useful tools for coloring graphics include 
colorspace, RColorBrewer, ggplot2, and plotrix.

hth,
Z
#
This does not fully answer your question, but there is a function col2grey (or col2gray) in the TeachingDemos package that will help you see what a given color plot will look like (approximately) when printed/photocopied in grayscale.

For your example you would do something like:
To view the grayscale version of the plot, then try with different colors until you are happy with the results.

Hope this helps,
#
Thanks,
   Here is my partial solution, from what you suggested me:
library(TeachingDemos)

z<-colors()
zz<-col2grey(z)
#index sorted
zzz<-sort(zz,index.return = TRUE)$ix

x<-z # colors in order or their greyscale
y<-z # greyscale sorted in gradient
for (i in 1:length(z)){
   x[i]<-z[zzz[i]]
   y[i]<-zz[zzz[i]]
}

myCol<-round(seq(from=1,to=length(x),length.out=10))
myCol<-x[myCol]

I then look at it and change to colors that are too similar for another
value close in geyscale.