[R] How to show numerical values on boxplots

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Nov 13 14:36:28 CET 2005


Yue Li wrote:
> Hi, dear all,
>  I want to show numerical values with decimal points on the boxplots. Here
> is what I did:
>  For example;
>  x1<-rnorm(100,2,2); x2<-rexp(100); label<-rep(1:2, rep(100,2))
> median<-round(c(median(x1), median(x2)),3)
> boxplot(c(x1, x2)~label, medpch=paste(median), medcex=1.2)

medpch issimilar as pch for a plotting character, but not a string.
Hence I'd add the median values by a call to text() as in:

bpo <- boxplot(c(x1, x2) ~ label, medcex=1.2)
text(1:2, bpo$stats[3,], median, pos=3)

Uwe Ligges



>   It only shows the integers at the median position in the boxplots. How to
> make it show more decimal points pls?
>  Thanks a lot.
> Lily
> NUS
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list