上图
数据形式如下:
p<-ggplot(data=dataplotshnnon, aes(x=groupd, y=shannon))+
scale_fill_manual(values = a)+
geom_violin(trim=FALSE,color="white",alpha=0.7,aes(fill=factor(groupd)),width=1)+
geom_boxplot(width=0.7 ,aes(fill=factor(groups)))+
labs(title="Alpha diversity", x="Group", y="Shannon index")+
theme(plot.title=element_text(hjust=0.5), legend.title=element_blank())+
theme(panel.grid = element_blank(), panel.background = element_rect(color = 'black', fill = 'transparent')) + #去掉背景
theme(axis.line = element_line(color = "black"))
p