ggplot2+ggsignif绘制箱图及添加显著性

library(ggplot2)#加载ggplot2包
library(ggsignif)#加载显著性包
setwd('d:')#设置工作路径
read.table('ahga.txt',header = TRUE,sep = '	',stringsAsFactors = T)#读取文件,保持标题,保持因素型变量
head(da)#展示前几行数据
compire<-list(c('A','B'),c('A','C'),c('B','C'))#添加要进行多重比较的数据列
ggplot(da,aes(x=Genotype,y=VLCFA,fill=Genotype))+geom_boxplot()+geom_signif(comparisons = compire,step_increase=0.5,map_signif_level = T,test = wilcox.test)#画箱图,并根据t检验结果,添加显著性
原文地址:https://www.cnblogs.com/xiaosagege/p/13121493.html