An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080318/24753492/attachment.pl
How to reverse colors in filled.contour?
2 messages · Ravi Varadhan, Bert Gunter
from the Help file: "color.palette: a color palette function to be used to assign colors in the plot." so color = function(x)rev(heat.colors(x)) should do it. -- Bert Gunter Genentech -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Ravi Varadhan Sent: Tuesday, March 18, 2008 2:52 PM To: r-help at stat.math.ethz.ch Subject: [R] How to reverse colors in filled.contour? Hi, I am plotting values of log(hazards ratio) as a function of two predictors, using the plotting function filled.contour(). Here is a simple simulated example of this: x <- seq(0,1, length=20) y <- seq(0,1, length=20) z <- outer(x,y, function(x,y) x^2 + y^2 ) zmat <- matrix( rexp(n=400, rate = z+0.001), 20, 20) filled.contour(x, y, log(zmat), xlab="X", ylab="Y", color=heat.colors, main="log-Hazard ratios for different X & Y cutoffs") Here lower hazard-ratios are reddish and higher values are lighter. I would like to reverse the color palette "heat.colors" such that higher hazard ratios are reddish and lower values are lighter. Can any one suggest an easy way to do this? Also, suggestions on better ways to display this information would be greatly appreciated. Thanks very much. Best, Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvaradhan at jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html ---------------------------------------------------------------------------- -------- ______________________________________________ R-help at 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.