I have a follow-up question to the one here.
This person wanted to make a correlation plot with ggcorrplot from the package ggcorrplot. However, they wanted to have the diagonal going down the matrix instead of up from left to right. So, they wanted to make the graph look like the correlation matrix that they used as input:
library(ggcorrplot)
data(mtcars)
corr.mat <- cor(mtcars[, c("mpg", "disp", "hp", "drat", "wt", "carb")])
ggcorrplot(corr.mat)
print(corr.mat)
The following solution was given, which works fine, as long as you use the specification type = "full". However, if you just want to show half of the graph, it gets messed up:
# This suggested solution works fine:
ggcorrplot(corr.mat[,6:1])
# The same:
ggcorrplot(corr.mat[,6:1], type = "full")
# Here we have the problem:
ggcorrplot(corr.mat[,6:1], type = "upper")
Does anyone know how to make that upper correlogram with the diagonal going from top-left to bottom-right?
You can plot corr.mat with
geom_tile
manually: