[R] Changing Color of Selected Column Names in Corrplot

David L Carlson dcarlson at tamu.edu
Fri Jun 16 18:08:34 CEST 2017

Hopefully someone has a cleaner approach, but this will work. You have to remove the first column/row labels and print with text():

M <- cor(mtcars)
colnames(M)[1] <- ""
rownames(M)[1] <- ""
corrplot(M, method="circle", type="lower", diag=F)
text(1, dim(M)[1] - .1, "mpg", srt=90, xpd=TRUE)

# Replace first row/colnames if you will be using M later
colnames(M)[1] <- "mpg"
rownames(M)[1] <- "mpg"

David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Lorenzo Isella
Sent: Friday, June 16, 2017 8:55 AM
To: r-help at r-project.org
Subject: [R] Changing Color of Selected Column Names in Corrplot

Dear All,
Please consider the following example

M <- cor(mtcars)
corrplot(M, method="circle", type="lower", diag=F)

Suppose that I want to have the label "mpg" at the top in black
and leave everything else in red.
How can I achieve that?


R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list