Closed cwilso6 closed 3 years ago
Is it possible to have both the matrix and the plot be output from corrplot? As of now, when I assign the plot to a variable it is a matrix. If I could access the plot object, then I think would able to use the desired packages.
You can try my R package ggcorrplot2, which currently implemented a subset of features of corrplot using ggplot2. Thus, you can combine multiple corrplots into one plot using cowplot or patchwork. See the following figure.
@caijun Your package looks great. However, for some reason, I can't install it. I tried various things but I keep getting "not available for 3.6.1..."
I haven't released ggcorrplot2 on CRAN, thus you are unable to install ggcorrplot2 via install.packages("ggcorrplot2")
. Try to install ggcorrplot2 from github:
if (!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("caijun/ggcorrplot2")
Yes, of course, I realised that. I tried through install_github but then I stumbled upon api problem. This is apparently related to my corporate computer because it now worked on my private mac. However, I still have some issues as it seems that ggcorrplot cant recognise some of the functions that it contains. For example, title, hc.order or lab.
Error in ggcorrplot(cor2, type = "upper", p.mat = p.mat2, hc.order = TRUE, : unused arguments (hc.order = TRUE, title = "Females")
ggcorrplot2 currently has implemented only a subset of features that corrplot has. The parameters hc.order
and title
are not supported yet. Please see the document of ggcorrplot()
.
With patchwork
and gridGraphics
you can plot multiple corrplots easily with the function wrap_elements
. You can do something like:
p1 = wrap_elements(~corrplot(M, method = "number", col = "black", cl.pos = "n", title='cutoff'))
p2 = wrap_elements(~corrplot(M))
p1 + p2
See further details at https://patchwork.data-imaginist.com/articles/guides/assembly.html.
I would like to be able to plot multiple corrplots on the same page. Is there a recommended way to plot them using ggpubr or gridExtra packages, preferably ggpubr. Below is an example:
Which produces the following error:
Again, I want to emphasize that my main goal is to use ggpubr or gridExtra