I want to had a custom dendrogram to an heatmap. I know I can add like this:
dend = as.dendrogram(hclust(dist(gene_matrix), method = 'ward.D')) dend = color_branches(dend, k = 4) Heatmap(gene_matrix, name = "Altered",top_annotation= colAnn, cluster_columns = dend, column_dend_reorder = FALSE)
However, even when I had column_dend_reorder, it automatically reorders the columns that are already ordered in the dendrogram.
When I remove the
cluster_columns=dend it does not reorder the columns and create a dendrogram, yet the dendrogram created is not with the same method that I want and it not colored.
So want to remove the dendrogram from the heatmap, and add 'dend' as a top annotation.
How can I do that?