Remove text labels of variables on diagonal corrplot
How can I remove text labels from diagonal only on corrplot?
my_correlation_matrix1 <- read.table("path/to/matrix", header = T)
my_correlation_matrix2 <- read.table("path/to/matrix", header = T)
corrplot(my_correlation_matrix1,
method = "color",
type = "lower",
tl.col = "black",
tl.cex = 0.6,
tl.srt = 45)
corrplot(my_correlation_matrix2,
method = "color",
type = "lower",
tl.col = "black",
tl.cex = 0.6,
tl.srt = 45,
add = T)
Since I'm using add = T, the 2 corrplots are merged in one plot. But because they have values on the diagonal, they are overlapping. How can this be fixed?
What I'm trying to do, is merge 2-corrplots-in-1. Two different studies for the same set of values. Upper triangular is measurement A and lower is measurement B.
• 6,230 views
•
link
1 answer
I do not know enough about corrplot to solve your problem tweaking the function's arguments. But instead, why don't you try making a new matrix containing the information you want to plot, and use a single call to corrplot? For example:
m <- my_correlation_matrix1
m[upper.tri(m)] <- my_correlation_matrix2[upper.tri(my_correlation_matrix2)]
m
corrplot(m,
method = "color",
tl.col = "black",
tl.cex = 0.6,
tl.srt = 45)
• 0 views
•
link
Log in to answer this question.
Not completely sure what you want to do but you could try modifying the values in the diagonal of your correlation matrix. Use
diagto access the diagonal:diag(my_matrix) <- <some_new_value>@ddiez I've updated the question. check it again.
Added an tentative answer. I assumed there is a typo in your code above and the second call to
corrplotsetstype = "upper". Is that correct?