ggsignif intro

Constantin Ahlmann-Eltze


This package provides an extension for the popular ggplot2 package.

Often people are looking for a way to quickly annotate if the difference between 2 groups in a plot is significantly different (look at all those questions). The usual answer is along the lines of just manually adding lines and annotation to the plot.

But I believe that a fundamental strength of ggplot is that it allows one to quickly make advanced plots by combining layers of visualization, which can encapsulate complex statistical methods (geom_smooth, geom_contour etc.).

So I created this package which provides a single layer geom_signif which can calculate the significance of a difference between groups and add the annotation to the plot in a single line.

How to use it?

First load both packages


Second step: plot your data

ggplot(iris, aes(x=Species, y=Sepal.Length)) + 
  geom_boxplot() +
  geom_signif(comparisons = list(c("versicolor", "virginica")), 

That’s it, it is really simple!

Advanced options

Sometimes one might need more advanced control over the display. To specify exactly where the bracket is drawn use the y_position, xmin and xmax parameters combined with a custom annotations. This is always necessary if geom_signif is combined with another layer that uses position="dodge", because it changes the location of the visual elements without updating the data.

For more detailed documentation of the available parameters see the man page for the geom_signif function (> ?geom_signif).

Bugs, Comments or Questions?

If you have any problems with the package, just file an issue at