基本图形绘制

R进行多组箱线图的绘制

2021-05-09  本文已影响0人  蜡笔小生信

上图

image.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 
上一篇 下一篇

猜你喜欢

热点阅读