使用 vegan 包更改颜色并添加标签到nestedtemp()图

问题描述 投票:0回答:1

我使用 R 包 vegan 来检查数据集中的嵌套性:

bc_rp <- read.csv("BC_RPc.csv", na.strings = c("","NA"), header=TRUE, check.names = FALSE)

bc_rp

bc <- data.frame(
  cell_layer = c("H", "B", "A", "G", "O"),
  Np = c(0, 1, 1, 0, 0),
  Pn = c(1, 1, 0, 0, 1),
  Npn = c(0, 1, 0, 0, 0),
  Npnp = c(0, 1, 0, 0, 0),
  Pnp = c(1, 0, 0, 0, 0),
  Pnpn = c(0, 1, 0, 0, 0)
)


# Renamed the columns to be easier to manipulate and have no special characters
# colnames(hc) <-c('species', 'a','b','c','d','e','f','g')

# Transpose the rows and columns in data. 
bc_t <-t(bc)

out_bc_t <- nestedtemp(bc_t)
out_bc_t
#nestedness temperature: 10.24168 
#with matrix fill 0.4 

plot(out_bc_t, kind="incid")

此代码按预期工作,生成嵌套温度和绘图。

嵌套温度:10.24168 矩阵填充 0.4

但是,我希望可以将绘图的颜色更改为红色以外的颜色,并为每种细胞类型和类别(np、pn 等)添加标签,我该怎么做?

r plot vegan presentation
1个回答
0
投票

一个好的起点是函数的文档(尝试

?nestedtemp
)。
plot
nestedtemp
函数似乎有参数
col
可用于设置颜色,而
names
默认为
names = FALSE
,但设置
TRUE
会添加名称(根据文档至少——我没有尝试)。如果这些对您没有帮助,请提出更详细的问题。

© www.soinside.com 2019 - 2024. All rights reserved.