Skip to content

Color Scale with Stard and End values

3 messages · Veronesi, Fabio, Matthew Landis, Jim Lemon

#
Fabio,
There are two ways to do it (see ?image):

You can specify min max for all of your images using the zlim argument, 
e.g. zlim = c(min(x), max(x))

Or you can use the breaks argument to control where the colors change.  
Note that I specify large values to catch values outside the desired 
min. and max. and also that there has to be 1 more break than colors.

E.g. image(x, col = terrain.colors(50), breaks = c( -1e99, seq(min(x), 
max(x), length = (51-2), 1e99)).


Matt
On 12/8/2010 12:25 PM, Veronesi, Fabio wrote:

  
    
#
On 12/09/2010 04:25 AM, Veronesi, Fabio wrote:
Hi Fabio,
If you just want the colors to change linearly with the values in a 
numeric scale that extends beyond the observed values, look at the 
second example for the barp function in the plotrix package. color.scale 
is not the only way to do this, but the method used there will work with 
other color scaling functions.
Jim