Open DickRLee opened 2 years ago
I tried to implement changes to address this issue here. You can try this out locally by installing:
devtools::install_github("LDSamson/ggcorrplot2@improve_labels")
It is not perfect, but it has some changes so that longer labels are slightly better supported. The labels are rotated by default (which is also the default behavior of the original corrplot package). Some labels can still be cut off, especially the first ones on top. I tried to mitigate that to dynamically assign additional plot padding, based on label length.
library(ggcorrplot2)
data(mtcars)
library(psych)
ct <- corr.test(mtcars, adjust = "none")
corr <- ct$r
p.mat <- ct$p
# example long labels:
colnames(corr) <- paste0(colnames(corr), "longlabel", sep = "")
rownames(corr) <- colnames(corr)
ggcorrplot(corr, type = "lower")
What do you think @caijun ?
@LDSamson thanks for your implementation. I have merged your PR.
@DickRLee You may try the latest version of ggcorrplot2.
Thank you so much for such a detailed user guide, it is very helpful for beginners like me. I'm a microbial ecology researcher and often deal with longer microbiology terms. I like the lower triangle graph in your package, but the text labels on the diagonal in it don't perform very well when the words are very long. Is there any parameter that I can use to choose to hide the diagonal text labels or adjust their position? Thank you very much! https://github.com/caijun/ggcorrplot2/blob/master/figs/README-unnamed-chunk-2-6.png