[R] boxplot in extreme cases

Liaw, Andy andy_liaw at merck.com
Mon Nov 8 00:59:21 CET 2004


x <- list(x1=rep(c(0,1,2),c(10,20,40)), x2=rep(c(0,1,2),c(10,40,20)))
boxplot(x, pars=list(medpch=20, medcex=3))

(Cf ?bxp, pointed to from ?boxplot.)


> From: Erich Neuwirth
> I noticed the following:
> the 2 datasets
> rep(c(0,1,2),c(10,20,40)) and
> rep(c(0,1,2),c(10,40,20))
> produce identical boxplots despite the fact that the medians are 
> different. The reason is that the median in one case 
> coincides with the
> first quartile, and in the second case with the third quartile.
> Is there a recommended way of displaying the median visibly in these 
> cases? Setting notch=TRUE displays the median, but does look strange.
> ______________________________________________
> 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