【发布时间】:2016-06-28 04:28:36
【问题描述】:
我正在使用 R corrplot 库。它看起来很神奇,但是为了产生一个非常好的图,我想更改相关矩阵的行和列的标签。
一种解决方案是这样做:
cbak <- colnames(my.data.frame)
colnames(my.data.frame) <- c("a", "set", "of", "labels")
corrplot(cor(my.data.frame))
colnames(my.data.frame) <- cbak
然而这看起来很奇怪和丑陋。
我想我应该使用 text() 函数的 labels 参数,但我不知道怎么做。
corrplot(cor(my.data.frame), labels=c("a", "set", "of", "labels"))
结果
Error in text.default(pos.xlabel[, 1], pos.xlabel[, 2], newcolnames, srt = tl.srt, :
invalid 'pos' value
In addition: Warning message:
In text.default(pos.xlabel[, 1], pos.xlabel[, 2], newcolnames, srt = tl.srt, :
NAs introduced by coercion
如何正确地做到这一点?
【问题讨论】:
标签: r r-corrplot