Skip to content

Easily add significance brackets to your ggplots

Notifications You must be signed in to change notification settings

kassambara/ggsignif

 
 

Repository files navigation

ggsignif

Easily add significance bars to your ggplots

Description

This package provides an easy way to indicate if two groups are significantly different. Commonly this is shown with a by a bar on top connecting the groups of interest which itself is annoted with the level of significance (NS, *, **, ***). The package provides a single layer (geom_signif) that takes the groups for comparison and the test (t.test, wilcox etc.) and adds the annotation to the plot.

Example

Install package

install.packages("ggsignif")

# Or for the latest development version
devtools::install_github("Artjom-Metro/ggsignif")

Plot significance

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)

Result Plot

For further details go the CRAN page and check the examples in the vignette.

About

Easily add significance brackets to your ggplots

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • R 100.0%