更改系统图的终端标签-plotBS函数{phangorn package}
对于特定的分类群,我想将终端/分类群颜色改为蓝色 我想把“蓬奎特湖”、“安斯利湖”、“黑河”、“平丘湖”和“蓝池”改成蓝色。有办法做到这一点吗 代码(下图):更改系统图的终端标签-plotBS函数{phangorn package},r,R,对于特定的分类群,我想将终端/分类群颜色改为蓝色 我想把“蓬奎特湖”、“安斯利湖”、“黑河”、“平丘湖”和“蓝池”改成蓝色。有办法做到这一点吗 代码(下图): datos未给出任何数据,因此示例不完全可再现。下面使用hclust的一般示例可能会给您一个想法: set.seed(123) x <- matrix(rnorm(100), nrow=20) row.names(x) <- LETTERS[1:20] # first 10 red, next 10 blue colors
datos未给出任何数据,因此示例不完全可再现。下面使用hclust
的一般示例可能会给您一个想法:
set.seed(123)
x <- matrix(rnorm(100), nrow=20)
row.names(x) <- LETTERS[1:20]
# first 10 red, next 10 blue
colors <- rep(c("red", "blue"), each=10)
hc <- hclust(dist(x))
plot(as.dendrogram(hc), horiz = TRUE, leaflab="none")
mtext(hc$labels, at=hc$order, side=4, line=0, col=colors, las=1)
set.seed(123)
x显示数据是向前迈出的一步,但仍然需要手动工作来帮助您。请进行转储,并包括结果:dump(datos)
I get:Error in FUN(X[[I]],…):无效的第一个参数抱歉,我的错误,请使用dput(datos)
。
set.seed(123)
x <- matrix(rnorm(100), nrow=20)
row.names(x) <- LETTERS[1:20]
# first 10 red, next 10 blue
colors <- rep(c("red", "blue"), each=10)
hc <- hclust(dist(x))
plot(as.dendrogram(hc), horiz = TRUE, leaflab="none")
mtext(hc$labels, at=hc$order, side=4, line=0, col=colors, las=1)