Skip to content

Help

3 messages · André Luis Neves, Jim Lemon, John Kane

#
Dear everyone,

Would like to know how to add asterisks and arcs that indicate a subgroup
comparison above box plots to denote statistical diference.

Thank you.

Andre
#
Hi Andre,
You can do it manually like this:

testmat<-matrix(rnorm(90),ncol=3)
boxplot(testmat,ylim=c(-3,4))
library(plotrix)
draw.arc(1.5,2,0.5,0,pi,col=1)
draw.arc(2.5,2,0.5,0,pi,col=1)
boxed.labels(c(1.5,2.5),c(3.3,3.3),c("**","***"),border=NA)

Obviously you would have to nudge the arcs and labels around to match
your plot. I don't know of a function that does this automatically.
Also if your aspect ratio is far from 1, the arcs won't be circular.
It is possible to write a function that will use the return values
from boxplot to display rectangular brackets above the boxplots and
then put the asterisks or whatever else you want on the top lines.

Jim
On Sat, Aug 15, 2015 at 5:46 AM, Andr? Luis Neves <andrluis at ualberta.ca> wrote:
#
Hi Andr?,
 You have not told us how you are creating the boxplots. See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and http://adv-r.had.co.nz/Reproducibility.html for some suggestions on how to ask a question for the R-help list.



John Kane
Kingston ON Canada
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!