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().は、th をプロットするかどうかを示すselect長さの論理ベクトル、またはプロットするものの (数値) インデックスのいずれかを取ります。次に、例は次のようになります。 :ii

## 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 に答える