Graph using corrplot for multiple sets of data
1
0
Entering edit mode
9.6 years ago
rvsaras86 • 0

I am using the corrplot package to create a graph for different sets of matrices. Is there anyway to merge all the graphs together into one using R?

R • 3.7k views
ADD COMMENT
0
Entering edit mode

Don't know what you mean by "merge graphs into one", but you can use multiplot function or gridExtra package (more on SO).

ADD REPLY
0
Entering edit mode

Thanks. By merge, I mean plot the different sets of correlation matrices I have on the same graph with a color code identifying the different sets.

ADD REPLY
0
Entering edit mode

So you want to use color for correlation, but use different pallets for different sets in the same graph? I doubt that this is possible in corrplot.

ADD REPLY
0
Entering edit mode

yes. Is there any other way of doing this,without using corrplot?

ADD REPLY
0
Entering edit mode

You can use ggplot to plot correlation matrix, but still have to use multiplot or gridExtra to merge multiple graphs.

ADD REPLY
2
Entering edit mode
21 months ago
DareDevil ★ 4.3k

You can try as follows:

library(corrplot)
data(mtcars)
M <- cor(mtcars)

col1 <- colorRampPalette(c("#7F0000","red","#FF7F00","yellow","white", "cyan", "#007FFF", "blue","#00007F"))

#this is my only addition
par(mfrow=c(2,2))

corrplot(M, method="color", col=col1(20), cl.length=21,order = "AOE", addCoef.col="grey")
corrplot(M, method="square", col=col1(200),order = "AOE")
corrplot(M, method="ellipse", col=col1(200),order = "AOE")
corrplot(M, method="shade", col=col1(20),order = "AOE")
ADD COMMENT

Login before adding your answer.

Traffic: 1898 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6