如何将规格名称添加到 rankabuncomp? [英] how to add specnames to rankabuncomp?

查看:62
本文介绍了如何将规格名称添加到 rankabuncomp?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将物种名称添加到 rankabuncomp 图中.我尝试将 specnames = T 添加到 rankabundance 函数,但出现错误.请帮我解决这个问题.非常感谢.

I am trying to add the species names to the rankabuncomp plot. I tried to add specnames = T to the rankabundance function but I get an error. Please help me work around this problem. Thanks a lot.

library(vegan)
library(BiodiversityR)
data(dune.env)
data(dune)
RankAbun.1 <- rankabundance(dune)
RankAbun.1
rankabunplot(RankAbun.1,scale='abundance', addit=FALSE, specnames=c(1,2,3))
rankabuncomp(dune, y=dune.env, factor='Management', scale='proportion',   legend=FALSE)
#to add specnames
rankabuncomp(dune, y=dune.env, factor='Management', specnames=c(1,2,3), scale='proportion', legend=FALSE, labels=FALSE)

推荐答案

BiodiversityR::rankabuncomp 明确禁止添加物种名称.这是在函数中硬编码的,如果不编辑函数则无法更改(在 rankabunplot() 调用中查找 specnames = NULL).帮助页面没有为 rankabuncomp 提供 specnames 参数,因此这也被记录在案.我可以理解这个决定:rankabuncomp 在一张图中画了几条线,而且这些线通常非常相似,以至于物种名称会相互覆盖,并且情节变得不可读.

BiodiversityR::rankabuncomp explicitly disallows adding species names. This is hardcoded in the function and cannot be changed without editing the function (look for specnames = NULL in rankabunplot() calls). The help page does not give specnames argument to rankabuncomp so that this is also documented. I can understand this decision: rankabuncomp draws several lines in one graph, and often these are so similar that species names would overwrite each other and the plot becomes unreadable.

要添加线条,您要么需要编辑函数,要么必须使用一系列 rankabunplot 命令在一个图中叠加图形.以下是如何使用 dune 数据执行此操作的示例:

To add the lines, you either need edit the function or you must use a series of rankabunplot commands to overlay graphs in one plot. Here is an example how to do that with the dune data:

library(BiodiversityR)
data(dune, dune.env)
## list of models
mods <- with(dune.env, lapply(levels(Management), function(lev)
    rankabundance(dune, dune.env, 'Management', lev)))
## level 4 seems to be most extreme: draw it first 
rankabunplot(mods[[4]],scale='abundance', addit=FALSE, specnames=c(1,2,3))
## add the rest
## change colour etc to separate the lines if wished
rankabunplot(mods[[3]],scale='abundance', addit=TRUE, specnames=c(1,2,3))
rankabunplot(mods[[2]],scale='abundance', addit=TRUE, specnames=c(1,2,3))
rankabunplot(mods[[1]],scale='abundance', addit=TRUE, specnames=c(1,2,3))

结果图可读性不高.如果使用 y 轴的比例缩放,则可读性会更低.但是,您可以做到这一点.

The resulting plot is not very readable. If you use proportional scaling of y-axis, it becomes even less readable. However, you can do it.

这篇关于如何将规格名称添加到 rankabuncomp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆