On Feb 8, 2010, at 12:06 PM, FMH wrote:
Hi,
The script below is my current coding in order to produce a contour
plot of temperature across altitude and time. In my case,
time,altitude and temperature are represented by x, y and z variables.
##############################################
Brazilan.Pallete <- colorRampPalette(c("blue","green","yellow","red"))
image.plot(x, y, z, col = Brazilan.Pallete(50))
contour(x,y,z, levels = seq(1, 20, by = 1), add = TRUE, col = 'peru')
##############################################
The plot worked fine but i found difficult to fix the interval of
the color corresponding to z value. In my case, the range of z
values is between 1 and 40 and i'd like to fix the color in the
image correspoding to four sub-intervals of z values. For instance:
1. 1 < z < 10 : blue
2. 11 < z < 20: green
3. 21 < z < 30: yellow
4. 31 < z < 40 : red.
I did't find a suitable coding to do this. Could someone please give
an advice on this matter?
Have you tried setting the number of colors in the palette to 40, and
the levels in image.plot at seq(1, 40, by=2). Wouldn't that get the
transitions and the contour lines to line up correctly at color
transitions?
Thank you.
Fir
______________________________________________
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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
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.