ggsignif
is a simple to use R package that provides an extension for ggplot2
to draw “significance brackets”.
library(ggplot2)
library(ggsignif)
ggplot(mpg, aes(class, hwy)) +
geom_boxplot() +
geom_signif(comparisons = list(c("compact", "midsize"), c("minivan", "suv")),
map_signif_level = TRUE, textsize=6) +
ylim(NA, 48)
For more information see the ggsignif
CRAN page and the corresponding Github repository.