Re: [R] Log color scale

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Sun 30 Jul 2006 - 20:25:51 EST

vincent@7d4.com wrote:

> Kartik Pappu a écrit :
>
>

>>However I need to plot my data in a log transformed color scale.  Is
>>this possible?  I will be happy to explain further, but basically I
>>need to do this because there are large variations in the max and min
>>values of my raw data and I am trying to highlight the differences in
>>the values at the lower end of my raw data (while still displaying the
>>values at the high end of the spectrum for comparison) so if figured
>>the best way to represent this on a (RGB) color scale is to do it with
>>a log transform.  I do not want to use too many colors because that
>>make the figure too busy.
>>Any suggestions on how to achieve this.

>
>
> Don't use too much time to search a good palette, build it yourself.

It is worth looking into the packages "RColorBrewer" and "colorspace". Some people thought about colors in graphics and wrote some code that might result in more appropriate colors and palettes than those that are quickly hacked...

Uwe Ligges

> build your own color palette, specific to your problem.
> It's not very difficult, see ?rgb et al.
>
> a small example (not a log scale) :
> palblancbleu = rgb(15:0, 15:0, 15, max=15);
> palrougeblanc = rgb(15, 0:15, 0:15, max=15);
> palblanc = rep(rgb(1,1,1), 8);
> palRBB = c(palrougeblanc, palblanc, palblancbleu);
>
> #palRBB = c(
> #"#FF0000","#FF1111","#FF2222","#FF3333","#FF4444","#FF5555","#FF6666","#FF7777"
> #,"#FF8888","#FF9999","#FFAAAA","#FFBBBB","#FFCCCC","#FFDDDD","#FFEEEE","#FFFFFF"
> #,"#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"
> #,"#FFFFFF","#EEEEFF","#DDDDFF","#CCCCFF","#BBBBFF","#AAAAFF","#9999FF","#8888FF"
> #,"#7777FF","#6666FF","#5555FF","#4444FF","#3333FF","#2222FF","#1111FF","#0000FF");
>
> # to visualize it
> # to visualize a palette
>
> showpal = function(pal=palRBB)
> {
> n = 200;
> fp = matrix(0,n,1);
> for (i in 1:n) fp[i,] = i;
>
> par(mar=c(0,0,0,0), mgp=c(0,0,0), ann=F);
> image(fp, col=pal);
> }
>
> (images at http://7d4.com/r/pal.php)
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.



R-help@stat.math.ethz.ch 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. Received on Sun Jul 30 20:24:09 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 01 Aug 2006 - 02:16:49 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.