Hi. I'm using pheatmap to create heatmaps. I've made a heatmap and used the clustering option (method = correlation) and the resulting heatmap has a certain row order based on the clustering. I want to make another heatmap using pheatmap that then has the same row order as the first one. Is there a way to specifically set the order of a second pheatmap based on the first?
I've been trying using the tree_row$order argument on the pheatmap object that I create. I think I can use this to set the order of the other, but then I don't know how to get pheatmap to display/write to file the changed pheatmap object.
Here's an example of some code:
create a pheatmap
hm_1<-pheatmap(mat1, cluster_rows=TRUE) hm_2<-pheatmap(mat1, cluster_rows=FALSE)
get the row order of another pheatmap and set the first to the second
hm_2$tree_row$order <-hm_1$tree_row$order
This works, but then I have this hm_2 object. How do I get it to display the resulting map again without calling the pheatmap argument?
And is there a batter way to do this?