[R] color of opposite sign values in filled.contour

From: Claudia Tebaldi <tebaldi_at_rap.ucar.edu>
Date: Thu 04 Jan 2007 - 23:30:15 GMT

Dear R-helpers,

I'm plotting geophysical data in the form of contours using "filled.contour". The display would be much more effective if the areas with negative values could be color coded by -- say -- "cold colors" in the range of blue to green, and conversely the areas with positive values got plotted with "warm colors", from yellow to red.
Right now if I use a palette spanning the spectrum I need the entire range is associated with the actual range of the data, which can be positively or negatively skewed, and as a result the position of the zero is totally arbitrary.
I'm wondering if someone out there has come up with a clever way to set the color scale accordingly, as a function of the actual range of the values in the matrix that is being plotted. Ideally, it would be neat to still use the entire spectrum, but sampling differently the cold and warm subsets accordingly to the extent of the negative and positive values in the data.

Also, when I try to play around in an ad hoc fashion with the palette I often get funny results in the legend, with color-scale wrapping or blank cells at one of the extremes. I cannot hack effectively the code of the filled.contour function, obviously...

Thank you in advance for your help
& happy new year

claudia tebaldi

Claudia Tebaldi

currently visiting
Center for Environmental Science and Policy
Stanford University
tel:   (650) 724-9261
skype: claudia.tebaldi

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri Jan 05 11:29:32 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 05 Jan 2007 - 09:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.