Re: [Rd] Brewer colours

2005-07-07 Thread Liaw, Andy
Do you mean something like:
http://cran.r-project.org/src/contrib/Descriptions/RColorBrewer.html
?

Andy

 From: Peter Kleiweg
 
 
 Anyone who is interested in using optimal colour palettes should
 look at the work of Cindy Brewer: www.colorbrewer.org
 
 I have written code to use her colour schemes in R. It is
 included below. Perhaps someone may find this interesting enough
 to work into a package.
 
 Included also is a function showpalette, which was posted here a
 while back. I don't remember who wrote it.
 
 I have copied all the palettes from colorbrewer with the maximum
 number of colours (which varies per palette). I have written a
 function that translates these colours directly to rgb, or
 through interpolation if you need a larger (or smaller) palette.
 If you need a smaller palette, you may have to go to
 www.colorbrewer.org for optimal results.
 
 There are three types of palettes:
 - Sequential, from minimal (light) to maximal (dark).
   There is no white in the original palettes. I added white.
 - Diverging, from one extreme (dark) through light to another
   extreme (dark, another colour).
 - Qualitative, no particular order.
 
 To view a palette with the original colours:
 
 showpalette(brewer2rgb(brewerSequential.YlGnBl))
 
 To view the same palette, interpolated to another number of
 colours:
 
 showpalette(brewer2rgb(brewerSequential.YlGnBl, 19))
 
 Notes:
 
   1. Interpolating Qualitative palettes does not work. You can't
  get more colours. If you need less, go to www.colorbrewer.org
 
   2. The palettes are tested to consist of colours that are
  optimally distinguishable to the human eye. Not all
  palettes may be useful in all circumstances or media. See
  www.colorbrewer.org for specs per palette and per number of
  colours. Interpolating to more colours will loose the
  distinction.
 
 The code:
 
 # www.colorbrewer.org
 
 brewerSequential.PuBu - array(data = c(
 255,255,255,
 255,247,251,
 236,231,242,
 208,209,230,
 166,189,219,
 116,169,207,
 54,144,192,
 5,112,176,
 4,90,141,
 2,56,88),
 dim = c(3, 10))
 
 brewerSequential.YlGnBl - array(data = c(
 255,255,255,
 255,255,217,
 237,248,177,
 199,233,180,
 127,205,187,
 65,182,196,
 29,145,192,
 34,94,168,
 37,52,148,
 8,29,88),
 dim = c(3, 10))
 
 brewerSequential.GnBu - array(data = c(
 255,255,255,
 247,252,240,
 224,243,219,
 204,235,197,
 168,221,181,
 123,204,196,
 78,179,211,
 43,140,190,
 8,104,172,
 8,64,129),
 dim = c(3, 10))
 
 brewerSequential.YlGn - array(data = c(
 255,255,255,
 255,255,229,
 247,252,185,
 217,240,163,
 173,221,142,
 120,198,121,
 65,171,93,
 35,132,67,
 0,104,55,
 0,69,41),
 dim = c(3, 10))
 
 brewerSequential.BuGn - array(data = c(
 255,255,255,
 247,252,253,
 229,245,249,
 204,236,230,
 153,216,201,
 102,194,164,
 65,174,118,
 35,139,69,
 0,109,44,
 0,68,27),
 dim = c(3, 10))
 
 brewerSequential.OrRd - array(data = c(
 255,255,255,
 255,247,236,
 254,232,200,
 253,212,158,
 253,187,132,
 252,141,89,
 239,101,72,
 215,48,31,
 179,0,0,
 127,0,0),
 dim = c(3, 10))
 
 brewerSequential.PuBuGn - array(data = c(
 255,255,255,
 255,247,251,
 236,226,240,
 208,209,230,
 166,189,219,
 103,169,207,
 54,144,192,
 2,129,138,
 1,108,89,
 1,70,54),
 dim = c(3, 10))
 
 brewerSequential.BuPu - array(data = c(
 255,255,255,
 247,252,253,
 224,236,244,
 191,211,230,
 158,188,218,
 140,150,198,
 140,107,177,
 136,65,157,
 129,15,124,
 77,0,75),
 dim = c(3, 10))
 
 brewerSequential.RdPu - array(data = c(
 255,255,255,
 255,247,243,
 253,224,221,
 252,197,192,
 250,159,181,
 247,104,161,
 221,52,151,
 174,1,126,
 122,1,119,
 73,0,106),
 dim = c(3, 10))
 
 brewerSequential.PuRd - array(data = c(
 255,255,255,
 247,244,249,
 231,225,239,
 212,185,218,
 201,148,199,
 223,101,176,
 231,41,138,
 206,18,86,
 152,0,67,
 103,0,31),
 dim = c(3, 10))
 
 brewerSequential.YlOrRd - array(data = c(
 255,255,255,
 255,255,204,
 255,237,160,
 254,217,118,
 254,178,76,
 253,141,60,
 252,78,42,
 227,26,28,
 189,0,38,
 128,0,38),
 dim = c(3, 10))
 
 brewerSequential.YlOrBr - array(data = c(
 255,255,255,
 255,255,229,
 255,247,188,
 254,227,145,
 254,196,79,
 254,153,41,
 236,112,20,
 204,76,2,
 153,52,4,
 102,37,6),
 dim = c(3, 10))
 
 brewerSequential.Purples - array(data = c(
 255,255,255,
 252,251,253,
 239,237,245,
 218,218,235,
 188,189,220,
 158,154,200,
 128,125,186,
 106,81,163,
 84,39,143,
 63,0,125),
 dim = c(3, 10))
 
 brewerSequential.Blues - array(data = c(
 255,255,255,
 247,251,255,
 222,235,247,
 198,219,239,
 158,202,225,
 107,174,214,
 66,146,198,
 33,113,181,
 8,81,156,
 8,48,107),
 dim = c(3, 10))
 
 brewerSequential.Greens - array(data = c(
 255,255,255,
 247,252,245,
 229,245,224,
 199,233,192,
 161,217,155,
 116,196,118,
 65,171,93,
 35,139,69,
 0,109,44,
 0,68,27),
 dim = c(3, 10))
 
 brewerSequential.Oranges - array(data = c(
 255,255,255,
 255,245,235,
 254,230,206,
 253,208,162,
 253,174,107,
 253,141,60,
 241,105,19,
 217,72,1,
 166,54,3,
 127,39,4),
 dim = c(3, 10))
 
 

Re: [Rd] Brewer colours

2005-07-07 Thread Peter Kleiweg
Liaw, Andy schreef op de 7e dag van de hooimaand van het jaar 2005:

 Do you mean something like:
 http://cran.r-project.org/src/contrib/Descriptions/RColorBrewer.html
 ?

Now I feel silly. Well, it was a nice exercise.


-- 
Peter Kleiweg
http://www.let.rug.nl/~kleiweg/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel