上图
![](https://img.haomeiwen.com/i15638536/fb16cf56666e1998.png)
image.png
数据形式如下:
![](https://img.haomeiwen.com/i15638536/083c28adec254fda.png)
image.png
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
网友评论