【R语言】箱线图统计检验线段长度

rm(list = ls())

data("iris")

library(ggplot2)
library(ggsignif)
library(ggsci)

comp_list = list(c('setosa','versicolor'),
                 c('setosa','virginica')) 

ggplot(iris, aes(Species, Sepal.Length, color = Species)) +
        geom_boxplot(width = 0.6) +
        geom_point(size = 1, alpha = 0.5) +
        geom_signif(comparisons = comp_list,
                    test = 'wilcox.test',
                    step_increase = 0.1,
                    map_signif_level = TRUE,
                    vjust = 0.5) +
        scale_x_discrete(limit = c('versicolor','setosa','virginica')) +
        scale_color_aaas() +
        theme_bw()+
        theme(legend.position = 'none')
ggplot(iris, aes(Species, Sepal.Length, color = Species)) +
        geom_boxplot(width = 0.6) +
        geom_point(size = 1, alpha = 0.5) +
        geom_signif(comparisons = comp_list,
                    test = 'wilcox.test',
                    step_increase = 0.1,
                    map_signif_level = TRUE,
                    vjust = 0.5,
                    y_position = c(8,8.5),
                    tip_length = c(0.1,0.25,
                                   0.7,0.1),
                    linetype = 'dashed',
                    color = 'black') +
        scale_x_discrete(limit = c('versicolor','setosa','virginica')) +
        scale_color_aaas() +
        theme_bw()+
        theme(legend.position = 'none')

你可能感兴趣的:(【R语言】箱线图统计检验线段长度)