Clustering in pheatmap and heatmaply R packages

冷暖自知 提交于 2021-01-29 15:20:17

问题


I am using the R heatmaply package to produce interactive heatmaps. I like the software, but I would like to get from it the same clustering (ordering of rows and columns) I get using the pheatmap package. Therefore, I would like the two commands to produce the same ouput:

heatmaply (scale (mtcars))
pheatmap  (scale (mtcars))

Is there a way to do this? Thanks in advance. Arturo

P.S. I recently asked another similar question about the color output, i.e., not clustering, output, that was brilliantly answered here: R heatmaply and pheatmap output


回答1:


Here is a solution to order columns and rows of heatmaply as in pheatmap:

phtmap <- pheatmap(scale(mtcars))
heatmaply(scale(mtcars), Rowv=phtmap[[1]], Colv=phtmap[[2]], revC=TRUE)

The ouput of pheatmap

and the output of heatmaply



来源:https://stackoverflow.com/questions/61935135/clustering-in-pheatmap-and-heatmaply-r-packages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!