好的beta多样性排序图可不是加一个置信椭圆就好了

写在前面

降维排序分析微生物群落的beta多样性,PCoA,NMDS,等都很常用。如果差异很明显,那么这些点无论是如何排布,都是很清晰的。但是如果是结果不好的排序,点与点之间机会错综复杂,乱七八糟的。那么··········对每个分组的点添加一个置信椭圆似乎是大部分人的做法,但是对于从总复杂的点,遗憾的是作用很小。这里我们提供几种方法。今天我带给大家几种高级方法,无论点有多乱,总可以有办法区分。最近的一篇nature子刊就使用了其中一种方法。19年的nature子刊:Foliar-feeding insects acquire microbiomes from the soil rather than the host plant看上去样本分离的不好,使用了这种方法。这种情况要使用椭圆圈起来就不行了

参考

食叶昆虫微生物群落来源于土壤而不是取食植物

Foliar-feeding insects acquire microbiomesfrom the soil rather than the host plant

Nature Communications, [11.935]/doi.org/10.1038/s41467-019-09284-wPublished online 02 August 2019第一作者:S. Emilia Hannula1通讯作者:T. Martijn Bezemer email: m.bezemer@nioo.knaw.nl)合作作者:Feng Zhu1,2, Robin Heinen1,3主要单位:1 荷兰,陆地生态研究所, The Netherlands Institute of Ecology NIOO-KNAW, Droevendaalsesteeg 10, 6708 PB Wageningen, The Netherlands.2 农业水资源重点实验室,河北省土壤生态重点实验室,农业资源研究中心,中国科学院遗传与发育生物学研究所。中国河北石家庄。

实战

library('vegan')
library('ggplot2')
data(dune, dune.env)
#--------nmds排序函数#---
ord <- metaMDS(dune)
scrs <- scores(ord, display = 'sites')
# 组合排序坐标和分组信息
scrs <- cbind(as.data.frame(scrs), Management = dune.env$Management)
# 求均值
cent <- aggregate(cbind(NMDS1, NMDS2) ~ Management, data = scrs, FUN = mean)
# 合并到样本坐标数据中
segs <- merge(scrs, setNames(cent, c('Management','oNMDS1','oNMDS2')),
by = 'Management', sort = FALSE)

出图

ggplot(scrs, aes(x = NMDS1, y = NMDS2, colour = Management)) +
geom_point(data = cent, size = 3) + # centroids
geom_point() + # sample scores
coord_fixed() + # same axis scaling
theme_void()

置信椭圆

ggplot(scrs, aes(x = NMDS1, y = NMDS2, colour = Management)) +
geom_point(data = cent, size = 3) +
geom_point() +
coord_fixed() +
stat_ellipse( linetype = 2,level = 0.65,aes(group = Management, colour = Management)) +
theme_void()

连线放射

ggplot(scrs, aes(x = NMDS1, y = NMDS2, colour = Management)) +
geom_segment(data = segs,
mapping = aes(xend = oNMDS1, yend = oNMDS2)) + # spiders
geom_point(data = cent, size = 3) + # centroids
geom_point() + # sample scores
coord_fixed() + # same axis scaling
theme_void()

波普样式

library(ggalt)
ggplot(scrs, aes(x = NMDS1, y = NMDS2, colour = Management)) +
geom_point(data = cent, size = 3) +
geom_point() +
coord_fixed() +
geom_bkde2d() +
theme_void()

外点连线

ggplot(scrs, aes(x = NMDS1, y = NMDS2, colour = Management)) +
geom_point(data = cent, size = 3) +
geom_point() +
coord_fixed() +
geom_encircle(s_shape=1, expand=0) +
theme_void()

(0)

相关推荐