Entering edit mode
3.4 years ago
5utr
▴
370
I have two versions of the same heatmap, clustered and unclustered. The unclustered version doesn't have the dendrogram on top and when I combine them with patchwork the don't align. How can I center the second heatmap so it aligns with the first one?
library(ggplot2)
library(ggplotify)
library(pheatmap)
library(patchwork)
# dummy df
mat = data.frame(matrix(rnorm(100), nrow=20))
# pheatmap as ggplot
g1 <- as.ggplot(pheatmap(mat))
g2 <- as.ggplot(pheatmap(mat,cluster_cols = F))
# combine
g1+g2
Indeed. ComplexHeatmap renders all other heatmap packages useless by providing any features one might want. pheatmap especially is pretty obsolete, as CH was built to address its shortcomings - as the developer puts it: