[R] Pairs() function: selective changing of ylim; use of key

David Afshartous dafshartous at med.miami.edu
Fri Jul 25 21:50:08 CEST 2008


All,

Two questions RE scatterplot matrices produced via pairs() function:

1) Is it possible to selectively change the ylim of one of the subplots?

2) Is a key allowed? I don't seem to be able to insert a manual key.

Code below:

dat = data.frame(Hour= rep(c(0:3), 4), Y1 = rnorm(16,1),
Y2 = rnorm(16,4),Drug = rep(c("P", "D"), each=4, 2) )

## this works:
pairs(dat, pch = 21, bg = c("red", "green3")[unclass(dat$Drug)])

## this produces several warnings:
pairs(dat, pch = 21, bg = c("red", "green3")[unclass(dat$Drug)],
key = list(space = "top",  text = levels(dat$Drug), lines =
list(col=c("red", "green3")), columns=2)  )

Cheers,
David



More information about the R-help mailing list