[R] add reference lines (or grid) in background

Luigi marongiu.luigi at gmail.com
Tue Sep 18 18:12:30 CEST 2012


Dear all ,
Thank you for the replies. The idea of plotting back on top of the grid was
the right direction and after browsing and browsing I found a tip in the R
archive ([R] How to get a grid behind a boxplot) by Neuro LeSuperHéros which
uses par(new=T):


x<-rnorm(100)
boxplot(x)
abline(h=c(-1,0,1))
grid(NA, 4, lwd = 2)
par(new=TRUE)
boxplot(x, col="white")

best wishes,
Luigi




More information about the R-help mailing list