Very conceptual doubt not sure if im doing it right or something terribly wrong so im using this corrplot library to calucate the correlation of my desired data frame after that i rounding it off but when i use my original calculated matrix such as
M i get a different plot again when i used the round of matrix i get a different plot in terms of correlation ,in case of
M all seems to be positively correlated but when i used the
corr i get plot which shows my cell types are both positively and negatively correlated .
Im posting my code below as well as the plot along with the data
library(corrplot) gendat = read.csv("NEW_RBP/TF_MYELOID_DISEASE.txt",row.names = 1,sep = "\t") dim(gendat) head(gendat) gen <- gendat head(gen) M<- cor(gen, use="complete.obs", method="spearman") corr <- round(cor(M),1) names(gen) dim(gen) mycolors <- rep(NA,23) names(mycolors) <- names(gen) mycolors[1:4] <- 'black' # mpg, cyl, disp, hp mycolors[5:15] <- 'red' # drat, wt, qsec, vs, am mycolors[16:23] <- 'blue' mycolors[13:16] <- 'darkgreen' ord <- corrMatOrder(corr, order="hclust") newcolours <- mycolors[ord] newcolours corrplot(M, tl.col = newcolours, method = "color",is.corr = FALSE, tl.srt = 45,diag = TRUE ,order = "hclust",hclust.method = c("complete"),addrect = 5,tl.cex = 3,number.cex=1.5) corrplot(corr, tl.col = newcolours, method = "color",is.corr = TRUE, tl.srt = 45,diag = TRUE ,order = "hclust",hclust.method = c("complete"),addrect = 3,tl.cex = 3,number.cex=1.5)
I would like to know what is happening in both the cases