[R] add reference lines (or grid) in background
John Kane
jrkrideau at inbox.com
Tue Sep 18 13:34:55 CEST 2012
Not sure if it is quite the same but ggplot2 does this as its default formatting.
library(ggplot2)
x<-rnorm(100)
qplot(factor(0),x, geom="boxplot")
John Kane
Kingston ON Canada
> -----Original Message-----
> From: marongiu.luigi at gmail.com
> Sent: Tue, 18 Sep 2012 09:35:47 +0100
> To: r-help at r-project.org
> Subject: [R] add reference lines (or grid) in background
>
> Dear all,
>
> Is there a simple way to add reference lines in background? I am trying
> with
> abline() or grid() but the lines, since they are executed after the plot
> function, are draw on top. How can I draw such lines beneath the main
> plot?
> Here is an example:
>
>
>
> x<-rnorm(100)
>
> boxplot(x)
>
> abline(h=c(-1,0,1))
>
> grid(NA, 4, lwd = 2)
>
>
>
> regards,
>
>
>
> Luigi Marongiu, MSc
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
____________________________________________________________
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails
More information about the R-help
mailing list