An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20101208/e6ec9a2c/attachment.pl>
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:
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 ~~~~~~~~~~~~~~~~~~~~~~~~~~
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