1

我有一个包含 100 个物种的数据集,因此绘制起来非常糟糕。所以我想挑选出这些物种的一个子集并将它们绘制在 RDA 图中。我一直遵循这个 指南

代码如下所示:

## load vegan
require("vegan")

## load the Dune data
data(dune, dune.env)

## PCA of the Dune data
mod <- rda(dune, scale = TRUE)

## plot the PCA
plot(mod, scaling = 3)

## build the plot up via vegan methods
scl <- 3 ## scaling == 3
colvec <- c("red2", "green4", "mediumblue")
plot(mod, type = "n", scaling = scl)
with(dune.env, points(mod, display = "sites", col = colvec[Use],
                  scaling = scl, pch = 21, bg = colvec[Use]))
text(mod, display = "species", scaling = scl, cex = 0.8, col = "darkcyan")
with(dune.env, legend("topright", legend = levels(Use), bty = "n",
                  col = colvec, pch = 21, pt.bg = colvec))

这是你最终得到的情节。现在我真的很想从情节中删除一些物种,但不是分析。所以情节只显示了 Salrep、Viclat、Aloge 和 Poatri。

帮助表示赞赏。

4

2 回答 2

2

您进行实际绘图的函数有一个参数select(至少text.cca()points.cca().select采用长度的逻辑向量来i指示是否i应该绘制第 th 事物,或要绘制的事物的(数字)索引。然后示例将变为:

## Load vegan
library("vegan")

## load the Dune data
data(dune, dune.env)

## PCA of the Dune data
mod <- rda(dune, scale = TRUE)

## plot the PCA
plot(mod, scaling = 3)

## build the plot up via vegan methods
scl <- 3 ## scaling == 3
colvec <- c("red2", "green4", "mediumblue")

## Show only these spp
sppwant <- c("Salirepe", "Vicilath", "Alopgeni", "Poatriv")
sel <- names(dune) %in% sppwant

## continue plotting
plot(mod, type = "n", scaling = scl)
with(dune.env, points(mod, display = "sites", col = colvec[Use],
                  scaling = scl, pch = 21, bg = colvec[Use]))
text(mod, display = "species", scaling = scl, cex = 0.8, col = "darkcyan",
     select = sel)
with(dune.env, legend("topright", legend = levels(Use), bty = "n",
                  col = colvec, pch = 21, pt.bg = colvec))

这给了你:

在此处输入图像描述

于 2015-01-07T16:01:34.623 回答
1

您也可以使用 -package 中的ordiselect()功能goeveghttps ://CRAN.R-project.org/package=goeveg

它根据丰度和/或适合轴的物种为排序图提供物种选择。

## Select ssp. with filter: 50% most abundant and 50% best fitting
library(goeveg)
sel <- ordiselect(dune, mod, ablim = 0.5, fitlim = 0.5)
sel   # 12 species selected

函数的结果对象(包含所选物种的名称)可以放入select参数中(如上所述)。

于 2017-01-25T10:10:06.323 回答