[R] stripchart with pch %in% 21:25 with bg

Jean lobry lobry at biomserv.univ-lyon1.fr
Thu Sep 24 10:27:48 CEST 2009


>stripchart.formula() works for me with your modification to
>stripchart.default().

Great!

>But you don't need the 'bordered' pch for that.

Indeed, but this may improve lisibility:

#####
n <- 500
x <- rnorm(n)
y <- rnorm(n)
fac1 <- rep(c("male", "female"), n)
fac2 <- rep(c("blue", "red"), each = n/2)
par(mfrow = c(1,2), lend = "butt", mar = c(5,4,1,1), oma = c(0,0,4,0))
plot(x, y, pch = ifelse(fac1 == "male", 15, 19), col = fac2, asp = 1)
mbg <- rgb(0.9, 0.9, 0.9, 0.9)
legend("topleft", inset = 0.02, c("male","female"), pch = c(15,19), bg = mbg)
legend("bottomright", inset = 0.02, c("blue","red"), col = c("blue","red"),
   bg = mbg, lty = 1, lwd = 5)
plot(x, y, pch = ifelse(fac1 == "male", 22, 21), bg = fac2, asp = 1)
legend("topleft", inset = 0.02, c("male","female"), pch = c(22, 21), bg = mbg)
legend("bottomright", inset = 0.02, c("blue","red"), col = c("blue","red"),
   bg = mbg, lty = 1, lwd = 5)
mtext("Comparison of pch c(15, 19) versus c(22, 21)", outer = TRUE,
   cex = 1.5, line = 1)
######

Best,

Jean
-- 
Jean R. Lobry            (lobry at biomserv.univ-lyon1.fr)
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 27 56     fax    : +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/




More information about the R-help mailing list