美文网首页基本图形绘制
R进行多组箱线图的绘制

R进行多组箱线图的绘制

作者: 蜡笔小生信 | 来源:发表于2021-05-09 16:07 被阅读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 
    

    相关文章

      网友评论

        本文标题:R进行多组箱线图的绘制

        本文链接:https://www.haomeiwen.com/subject/mxtvdltx.html