I am using R corrplot library. It looks amazing, however to produce a really good plot I want to change the labels of rows and columns of the correlation matrix.
One solution is to do something like this:
cbak <- colnames(my.data.frame)
colnames(my.data.frame) <- c("a", "set", "of", "labels")
corrplot(cor(my.data.frame))
colnames(my.data.frame) <- cbak
However this looks strange and ugly.
I guess I should work with the labels
parameter of a text()
function, but I can't figure how.
corrplot(cor(my.data.frame), labels=c("a", "set", "of", "labels"))
results in
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
How to do this correctly?