感謝大師兄的幫助!
首先我們看一下輸入的數(shù)據(jù)結(jié)構(gòu):

分為5組,4種類型
接著我們對輸入數(shù)據(jù)進(jìn)行處理:
###加載R包
library(tidyr)
library(dplyr)
###數(shù)據(jù)轉(zhuǎn)換
df <- a %>% pivot_longer(-group,names_to = "SV_type",values_to = "Count")
轉(zhuǎn)換后的數(shù)據(jù)格式:

數(shù)據(jù)分為三組
畫圖代碼:
library(ggplot2)
####可以先畫一組
e <- ggplot(df, aes(x = group, y = Count))
e + geom_boxplot()
####添加分類變量
e2 <- e + geom_boxplot(
aes(fill = SV_type),
position = position_dodge(0.9)
) +
scale_fill_manual(values = c("#7700FF", "#33ff00","#00AFBB", "#E7B800"))
e2+ theme_bw()+ theme_bw() +
theme(panel.grid=element_blank())
e2

最后的結(jié)果圖
###t添加組間多重比較
compaired <- list(c("Aus", "GJ"),
c("Aus","rufipogon"),
c("Bas","GJ"),
c("rufipogon","GJ"),
c("XI","GJ"),
c("XI","rufipogon"))
e2+theme_bw() +
theme(panel.grid=element_blank())+
geom_signif(comparisons = compaired,
step_increase = 0.3,
map_signif_level = T, #修改參數(shù)map_signif_level=TRUE
test = wilcox.test)

添加顯著性后