我使用R中的vegan
包来使用函数metaMDS
执行非度量多维缩放。为此,我使用文件equilibria0.txt,其中列中有101种(第一列代表我的点阵模型中的空站点),行中有500个社区。我使用以下R代码来执行NMDS:
library(vegan) # perform NMDS
library(cluster) # calculate dissimilarities in data, silhouette scores, ...
library(RColorBrewer) # better colour options
comm <- read.table("equilibria0.txt") # communities in rows, species in columns
comm <- comm[,-1] # delete the first column (the empty sites)
comm <- decostand(comm, method = "total")*100
NMDS <- metaMDS(comm, # our community-by-species matrix
k=2) # the number of reduced dimensions
k <- 2 # number of clusters
# introduce some colours for the clusters
lightcolours <- c("darkolivegreen3", "cadetblue3")
# calculate Bray-Curtis distance among samples
comm.bc.dist <- vegdist(comm, method = "bray")
# cluster communities using average-linkage algorithm
comm.bc.clust <- hclust(comm.bc.dist, method = "average")
# k is the number of clusters we want
# every LC is assigned a number from 1 to k
comm.bc.cut <- cutree(comm.bc.clust, k=2)
# set up the plotting area but don't plot anything yet
mds.fig <- ordiplot(NMDS, type = "none")
# plot just the samples, colour by cluster, pch=19 means plot a circle
for (i in 1:k) {
points(mds.fig,
"sites",
pch = 19,
col = lightcolours[i],
select = comm.bc.cut == i)
}
现在我有another 30 files,全部与equilibria0.txt
相同,但第一行除外。换句话说,在500个当地社区中,499个没有变化,一个(第一行)发生了变化。这是因为我在本地社区进行了一些小的更改,以确定在此更改之后它是否会及时发展到其他群集。所以我想在一个图中得到这30个文件的所有信息,特别是显示如下图所示的轨迹,可以在Gibson et al的论文中找到:
非常具体地说,有一个当地社区(在NMDS平面上的点)感兴趣。如果您从equilibria0.txt
转到equilibria1.txt
到equilibria2.txt
等,它相对于其他坐标的坐标会发生变化,这些数据文件实际上是不同时间步的数据文件。因此,我想绘制这个特定的当地社区的演变,最好是通过如上所述的轨迹线。我假设其他499个点(社区)的坐标不会发生显着变化。