[R-sig-Geo] Color Scale with Stard and End values

Jim Lemon jim at bitwrit.com.au
Thu Dec 9 10:12:36 CET 2010


On 12/09/2010 04:25 AM, Veronesi, Fabio wrote:
> Hi,
> I'm creating a series of images slicing a 3D dataset and I'm using the option for the function image: col=terrain.colors(50).
> My problem is that, because I have a loop that subset the dataset based on the depth, each image have a slight different range of values of the main variable. Therefore, the color scale changes slightly for each image.
> Is it possible to create a color scale with terrain colors in which I fiz the starting value and the end value?
> So basically I need to say to the program to assign to the color green the data value x.xx (which will be the minimum of my data) and to the value white the maximum of my data.
> Green and white are the two end color of the terrain color scale.

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



More information about the R-sig-Geo mailing list