[R] adjusting color palette

Barry Rowlingson B.Rowlingson at lancaster.ac.uk
Mon Jun 14 14:33:12 CEST 2004

Laura Quinn wrote:
> Is there a way to increase the "sensitivity" of the color palette in order
> to more clearly represent certain sections of data? For example I am
> wanting to clearly differentiate between height data for a rolling
> landscape but because of the extremes of the dataset (sea and mountain
> tops), the bulk of the landscape is shaded in closely approximating green
> - i have attempted to do this by using a larger color palette but this
> doesn't make things any clearer.

  The colour is selected linearly by the value you are drawing. Hence 
two solutions present themselves:

  one, non-linearly scale your data. for your application I think 
squaring x-mean(x) might stretch out the tails.

  two, constructing a non-linearly varying palette. you can do this by 
mucking about with the red, green, and blue values from the palette.

  the functions 'col2rgb' and 'rgb' are useful.


More information about the R-help mailing list