How to draw the boxplot with significant level?

前端 未结 2 966
迷失自我
迷失自我 2020-12-01 01:26

Some time ago I asked a question about drawing boxplot Link1.

I have got some data with 3 different groups (or labels) Please down load here. I can use the following

2条回答
  •  悲哀的现实
    2020-12-01 02:06

    I know that this is an old question and the answer by DatamineR already provides one solution for the problem. But I recently created a ggplot-extension that simplifies the whole process of adding significance bars: ggsignif

    Instead of tediously adding the geom_line and annotate to your plot you just add a single layer geom_signif:

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

    Full documentation of the package is available at CRAN.

提交回复
热议问题