R语言microeco:一个用于微生物群落生态学数据挖掘的R包,第二讲(trans_abund class)

上次我们分享了microeco对象的构建与数据前处理,这次分享microeco包的trans_abund class,该类用于转换分类丰度数据,以便使用ggplot2包绘制分类群丰度。我们首先使用这个类来绘制条形图。

t1 <- trans_abund$new(dataset = dataset, taxrank = "Phylum", ntaxa = 10)
t1
#我们删除x轴上的样本名称,并添加facet以根据组显示丰度。
t1$plot_bar(others_color = "grey70", facet = "Group", xtext_keep = FALSE, legend_text_italic = FALSE) #出现门水平的柱状图。

#参数groupmean可用于获取组均值柱状图。
t1 <- trans_abund$new(dataset = dataset, taxrank = "Phylum", ntaxa = 10, groupmean = "Group")
t1$plot_bar(others_color = "grey70", legend_text_italic = FALSE)

#也可以画箱线图。
t1 <- trans_abund$new(dataset = dataset, taxrank = "Class", ntaxa = 15)
t1$plot_box(group = "Group")

#热图。
t1 <- trans_abund$new(dataset = dataset, taxrank = "Genus", ntaxa = 40)
t1$plot_heatmap(facet = "Group", xtext_keep = FALSE, withmargin = FALSE)

好了,今日先分享到这里,还有一些图,我遇到了bug,暂时无法解决,我以前却没有遇到。生信可能就是这样,一坑接一坑。我分享的也是兄弟姐妹们在网上分享的东西,也谢谢他(她)们。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>