美文网首页
R packages:phyloseq修改分组顺序

R packages:phyloseq修改分组顺序

作者: 佳名 | 来源:发表于2021-03-10 10:03 被阅读0次

没有修改之前,默认顺序

library(MicrobiotaProcess)
phytax <- get_taxadf(qiimedata, taxlevel=2)
phybar <- ggbartax(obj=phytax,facetNames="group", count=FALSE) +
  xlab(NULL) + ylab("Relative abundance (%)")+
  theme(axis.text.x=element_text(face="plain",
                                 color="black",hjust=0.8,vjust=0.6,
                                 size=9, angle=90))+
  theme(legend.position="right")
phybar
Fig01.png

但是,我想把组顺序修改为:CON,HFD,FA。

qiimedata@sam_data[["group"]]<-factor(qiimedata@sam_data[["group"]],levels = c("CON","HFD","FA"))
phytax <- get_taxadf(qiimedata, taxlevel=2)
phybar <- ggbartax(obj=phytax,facetNames="group", count=FALSE) +
  xlab(NULL) + ylab("Relative abundance (%)")+
  theme(axis.text.x=element_text(face="plain",
                                 color="black",hjust=0.8,vjust=0.6,
                                 size=9, angle=90))+
  theme(legend.position="right")
phybar
Fig02.png

相关文章

网友评论

      本文标题:R packages:phyloseq修改分组顺序

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