[R] indicating significant differences in boxplots
jim at bitwrit.com.au
Mon Oct 28 20:57:49 CET 2013
On 10/29/2013 01:51 AM, Johannes Radinger wrote:
> I'd like to follow up an older discussion on adding significance stars to
> As suggested by Jim Lemon, there is following solution for a single boxplot:
> boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
> #and we'll assume that the second and third boxplots require a star:
> But what if one wants to plot two boxplots (e.g. with each only two groups
> which are significantly different) and
> add such stars to each of the boxplots. I usually use par(mfrow(1,2)) to
> plot all boxplots in a row.
> How can I also add segments and stars on top of each plot?
The general strategy above can be applied. Fortunately, boxplots are
centered on successive integers (i.e. 1,2,...) by default. The
calculations for ypos yield 1/40th of the vertical span of the plot
above the top of the plot. Just add the segments and stars after each
plot, as each boxplot advances to the next frame in your plot matrix.
More information about the R-help