Try this: panel.cor <- function(x, y, ...) { r <- abs(cor(x, y)) u <- par('usr') names(u) <- c("xleft", "xright", "ybottom", "ytop") bgcolor <- ifelse(r > 0.5, 'red', 'blue') do.call(rect, c(col = bgcolor, as.list(u))) points(x, y) }
pairs(USJudgeRatings, panel=panel.cor) On Sat, Jun 13, 2009 at 10:19 PM, Naoki Irye <asur...@cdb.riken.jp> wrote: > Dear list > > Is there any way that I can color the background (not the plotted points) > of > each box in "pairs" ? > > I'd like to color them according to the correlation coefficiency of > each data pair. > > thanks. > > > N > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ 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.