[R] adding the mean and standard deviation to boxplots

Gabor Grothendieck ggrothendieck at gmail.com
Mon Feb 4 17:59:32 CET 2008


Not precisely what you asked for but see the notch= argument to boxplot
for a graphic measure of variability.  If you simply wish to print certain
statistics below the numbers already on the X axis then see:

https://stat.ethz.ch/pipermail/r-help/2008-January/152994.html

On Feb 4, 2008 10:41 AM, Tom Cohen <tom.cohen78 at yahoo.se> wrote:
> Dear list,
>
>  How can I add the mean and standard deviation to each of the boxplots using the example provided  in the boxplot function?
>
> boxplot(len ~ dose, data = ToothGrowth,
>        boxwex = 0.25, at = 1:3 - 0.2,
>        subset = supp == "VC", col = "yellow",
>        main = "Guinea Pigs' Tooth Growth",
>        xlab = "Vitamin C dose mg",
>        ylab = "tooth length", ylim = c(0, 35), yaxs = "i")
> boxplot(len ~ dose, data = ToothGrowth, add = TRUE,
>        boxwex = 0.25, at = 1:3 + 0.2,
>        subset = supp == "OJ", col = "orange")
> legend(2, 9, c("Ascorbic acid", "Orange juice"),
>       fill = c("yellow", "orange"))
>
> Thanks for any help,
>  Tom
>
>
> ---------------------------------
>
> Jämför pris på flygbiljetter och hotellrum: http://shopping.yahoo.se/c-169901-resor-biljetter.html
>        [[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.
>
>



More information about the R-help mailing list