On 12/27/2010 02:21 PM, randhindi wrote:

Hi,

I am trying to set the color scale in filled.contour based on a specific
value instead of a relative position.
Specifically, I want the values below 0 to be in a gradient of green, and
those above 0 to be red. 0 would be white.

I tried:

posZero = abs(min(z)) / (abs(min(z)) + max(z));
filed.contour(..., col = designer.colors(n=30, col=c("green", "white",
"red"), x=c(0, posZero, 1)))

but it does not center the white on the zero.

Hi Rand,
Have a look at the examples for color2D.matplot in the plotrix package. These show how to use color.scale to produce a set of colors like you describe above.

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to