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

Matthew Landis landis at isciences.com
Wed Dec 8 18:58:11 CET 2010


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:
> 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.
> Many thanks,
> Fabio
>
>
> Mr. Fabio Veronesi
> Ph.D. student
>
> Cranfield University
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~
Matthew Landis, Ph.D.
Research Scientist
ISciences, LLC
61 Main St. Suite 200
Burlington VT 05401
802.864.2999
~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the R-sig-Geo mailing list