how to plot correlation matrix in R using corrplot package for large dataset

176 Views Asked by At

I am trying to plot correlation matrix in R. In my case the dataset is big so when I use corrplot package to plot the correlation my plot x and y axis are getting mixed up. I have added my dataset for reference and code.

   data.corr <- cor(cis_gt) %>% as.matrix()
dim(data.corr)
128 128
dput(data.corr[1:5,1:5])
structure(c(1, 1, 0.106232768310608, -0.0488645759458282, -0.0866276343339234, 
1, 1, 0.106232768310608, -0.0488645759458282, -0.0866276343339234, 
0.106232768310608, 0.106232768310608, 1, -0.108531002181544, 
0.219384187728778, -0.0488645759458282, -0.0488645759458282, 
-0.108531002181544, 1, -0.040291148201269, -0.0866276343339234, 
-0.0866276343339234, 0.219384187728778, -0.040291148201269, 1
), dim = c(5L, 5L), dimnames = list(c("ID1", "ID2", "ID3", "ID4", 
"ID5"), c("ID1", "ID2", "ID3", "ID4", "ID5")))
    library(corrplot)
    corrplot(data.corr)
heatmap(data.corr)

I also tried to plot using heatmap, but in that case its only showing certain IDs only. Is there any way to modify this code to generate a more cleaner plot or select only those region that shows higher correlation and use it to plot? or zoom to the region which shows those blue spots. I will be highly grateful if I can get some guidance on this. Thank you.

enter image description here

enter image description here

0

There are 0 best solutions below