Lorenzo Isella
2017-Jun-16 13:54 UTC
[R] Changing Color of Selected Column Names in Corrplot
Dear All, Please consider the following example library(corrplot) 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? Cheers Lorenzo
David L Carlson
2017-Jun-16 16:08 UTC
[R] Changing Color of Selected Column Names in Corrplot
Hopefully someone has a cleaner approach, but this will work. You have to remove the first column/row labels and print with text(): library(corrplot) 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 library(corrplot) 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? Cheers Lorenzo ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Possibly Parallel Threads
- length of 'dimnames' [2] not equal to array extent- For Correlation Plot
- length of 'dimnames' [2] not equal to array extent- For Correlation Plot
- how to plot a graph with different pch
- suggestion: "." in [lsv]apply()
- Why copying columns of a data.frame becomes numeric?