{"word_count": 239, "character_count": 2085}
In a recent issue of Significance, I discovered an interesting - and amuzing - figure, about some box &#38; beard plot, in Dr Fisher's casebook: Beard the statistician in his den.In French, the box plot (introduced by John Tukey, not George Box, as discussed in a previous post) is popular under the name boîte à moustaches (box with a mustache, for a simple translation).&#62; set.seed(2)&#62; x=rnorm(500)&#62; boxplot(x,horizontal=TRUE,axes=FALSE)&#62; axis(1)I was wondering if it was possible to reproduce that Fisher's style of box plot, with a beard (Ronald Fisher was famous for his beard). Technically, it is not complicated,&#62; boxplot(x,horizontal=TRUE,xlim=c(-1,1.3),axes=FALSE)&#62; axis(1)&#62; Q=quantile(x,c(.25,.75))&#62; y=cut(x[(x&#62;=Q[1])&#38;(x&#60;=Q[2])],seq(Q[1],Q[2],length=11))&#62; tb=table(y)&#62; u=seq(Q[1],Q[2],length=11)&#62; umid=(u[1:10]+u[2:11])/2&#62; for(i in 1:10) segments(umid[i],1-.2,umid[i],1-.2-tb[i]/20,lwd=3)Yes, I kept the mustaches here, but ploting a simple box, one could easily draw a goatee, or a chin strip&#62; rect(Q[1],1-.2,Q[2],1+.2)&#62; segments(median(x),1-.2,median(x),1+.2,lwd=2)The only problem, is that between the first and the third quartiles, the distribution is much more 'uniform' than it might look on the figure in Significance. Unless, perhaps, if add more bars on the left of the first quartile, and on the right of the third one,&#62; du=diff(umid)[1]&#62; y=cut(x,seq(Q[1]-du*8,Q[2]+du*8,length=11+16))&#62; tb=table(y)&#62; u=seq(Q[1]-du*8,Q[2]+du*8,length=11+16)&#62; umid=(u[1:26]+u[2:27])/2&#62; for(i in 1:8) segments(umid[i],1,umid[i],1-.2-tb[i]/20,lwd=3)&#62; for(i in 19:26) segments(umid[i],1,umid[i],1-.2-tb[i]/20,lwd=3)Of course, we can try to add a smile on that face, below the mustache,&#62; vu=seq(-2.5,2.5,by=.02)&#62; vv=dnorm(vu)&#62; lines(vu,1-vv*4,col="red",lty=2)&#62; d=density(x,bw=.1)&#62; lines(d$x,1-d$y*4,col="red")So far, I am not convinced. I mean, it should be possible to add something on the box plot,  to add more information. But I still wonder what... maybe using colors?