R packages:phyloseq修改分组顺序

2021-03-10  本文已影响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
上一篇 下一篇

猜你喜欢

热点阅读