问题描述
我注意到 corrplot 制作的相关图与 pheatmap 制作的不同。 原始数据: enter link description here
corrplot 中的相关矩阵,
count = read.csv('data_here.csv')
mtx = cor(count,method = 'kendall')
corrplot(mtx,method="color",tl.cex = .35,order="hclust",hclust.method = 'complete')
想在图的轴上添加树状图,但还没有使用 ccorrplot 弄清楚... 所以我尝试了 pheatmap,
mtx %>% pheatmap(
fontsize = 3,clustering_method = 'complete')
很明显,这两个包的集群方式不同。例如基因 RSPO3
解决方法
受到这篇文章的启发, https://www.datanovia.com/en/blog/clustering-using-correlation-as-distance-measures-in-r/
就是这样想出来的!
pheatmap(mtx,fontsize = 3,clustering_distance_cols = as.dist(1 - mtx),clustering_distance_rows = as.dist(1 - mtx)
)