R 素食主义者 envfit 标签不随 arrow.mul 移动?



我正在使用 envfit 在 R 中用环境向量制作 NMDS 排序图,我的一些环境变量中缺少值。为了不从一个变量中包含缺失值的所有变量中排除所有行(如 na.rm=TRUE),我分别对每个变量运行 envfit,但现在想在同一图上绘制结果。因此,我需要使用 arrow.mul 参数来使箭头的比例彼此比较。在这里,我遇到了我的问题:向量的标签位置似乎不听 arrow.mul,标签保持在它们的原始位置,漂浮在空间中。

如果有人能告诉我如何让标签移动到新的箭头点位置,或者建议缺失值的解决方法,那就太棒了。我希望我没有错过一些明显的东西!

以下是使用素食主义者沙丘数据的顽固标签的可重现示例:

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,但宁愿现在不要,只是为了这个......

这确实是素食主义者中的一个错误。我会在github中修复它。同时,您可以使用plot(ev, arrow.mul = 1, rescale = FALSE)来浮动文本。这会给你一个警告,但它是无害的,并且会起作用。同时,我将在素食主义者中解决此问题。

最新更新