【发布时间】:2018-03-13 15:16:17
【问题描述】:
我正在使用 envfit 使用环境向量在 R 中制作 NMDS 排序图,并且我的一些环境变量中缺少值。为了不排除在一个变量中包含缺失值的所有变量中的所有行(与 na.rm=TRUE 一样),我已分别对每个变量运行 envfit,但现在想在同一个图上绘制结果。因此,我需要使用 arrow.mul 参数来使箭头的比例彼此可比。在这里我遇到了我的问题:向量标签的位置似乎不听arrow.mul,标签停留在原来的位置,漂浮在空间中。
如果有人能告诉我如何让标签移动到新的箭头位置,或者为缺失值提出解决方法,那就太好了。我希望我没有遗漏一些明显的东西!
这是一个使用来自 vegan 的沙丘数据的顽固标签的可重复示例:
data(dune)
data(dune.env)
de2<-dune.env[,c(1,2)]
ord<-metaMDS(dune,k=2)
plot(ord)
de2$Moisture<-as.numeric(de2$Moisture) #pretend this is numeric
ev<-envfit(ord,de2,choices=c(1,2))
ordiplot(ord,type="n")
points(ord,pch=16,col=c(1:4)[dune.env$Management])
plot(ev,arrow.mul=1,labels=list(vectors=c("A1","Moisture")),
col="black",cex=0.9,bg="white")#floating labels
plot(ev,labels=list(vectors=c("A1","Moisture")),
col="black",cex=0.9,bg="white")#labels are fine with no arrow.mul
plot(ev,arrow.mul=1) #default labels behave the same and float with arrow.mul
(是的,我知道我应该学习使用 ggplot,但不希望现在,只是为了这个......)
【问题讨论】:
-
看起来像一个应该修复的错误。