[R-sig-Geo] help with color scale

Muhammad Rahiz muhammad.rahiz at ouce.ox.ac.uk
Sun May 2 20:10:49 CEST 2010


Hi all,

I hope someone can help me with this.

Given,

library(fields)
x <- array(rnorm(100),dim=c(50,50))
image.plot(x)

I want to change the range in the color bar so that the range is from -1 
to 1. I did adjust the image.plot() command to

image.plot(x,zlim=c(-1,1))

but the image shows white spaces.

How can I set the the color scale such that values  which are less than 
- 1 are assigned a color e.g. blue and those which are more than  1 are 
assigned red.

In essence, how do I make the color scale to reflect the a certain band 
of values i.e.

color 1 = > 1
color 2 =  0.9 to 1
color 3 = 0.8 to 0.9
...
color 8 = -0.8 to -0.9
color 9 = -0.9 to -1
color 10  = < -1


Muhammad



More information about the R-sig-Geo mailing list