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 -- View this message in context: http://www.nabble.com/Colormap-that-look-good-in-gray-scale-tp22336097p22336097.html Sent from the R help mailing list archive at Nabble.com.
On Wed, 4 Mar 2009, thibert wrote:> > 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.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> Thanks > -- > View this message in context: http://www.nabble.com/Colormap-that-look-good-in-gray-scale-tp22336097p22336097.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >
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:> plot(1:6,col=col2grey(c(1,7,5,3,2,4)),pch=c(1,20,20,20,20,20))To view the grayscale version of the plot, then try with different colors until you are happy with the results. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of thibert > Sent: Wednesday, March 04, 2009 11:23 AM > To: r-help at r-project.org > Subject: [R] Colormap that look good in gray scale > > > 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 > -- > View this message in context: http://www.nabble.com/Colormap-that-look- > good-in-gray-scale-tp22336097p22336097.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.
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. -- View this message in context: http://www.nabble.com/Colormap-that-look-good-in-gray-scale-tp22336097p22339785.html Sent from the R help mailing list archive at Nabble.com.