How do I add an asterix to a boxplot to represent significance?

user1250704 picture user1250704 · Mar 5, 2012 · Viewed 28.7k times · Source

I am trying to include an asterix on top or bottom of a box in boxplot graph that represent significance after performing the independent variable t-test evaluation. How can I add this to my graph?

Answer

Geek On Acid picture Geek On Acid · Mar 5, 2012

You can use text() to add simple symbols to custom location on the plot:

boxplot(c(1:10),ylim=c(0,12),axes=F)
text(11,"*",cex=2)

enter image description here

EDIT: In reply to @chl suggestion, here is the above application with a series of boxplots:

boxplot(count ~ spray,data = InsectSprays,axes=F,ylim=c(0,30))
text(c(25,23,-10,-10,-10,27),"*",cex=2)

enter image description here