This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to keep ComplexHeatmap from reordering annotations

I am using complex heatmap to plot a gene alteration matrix with a dendrogram on top but, below the dendrogram I want to have a color map with the diseases that each patient has:

column_ha = HeatmapAnnotation(Disease = Clinical_data$Disease ) Heatmap(t(gene_matrix), name = "Altered", cluster_columns = dend)

When I plot column_ha, the order of the diseases is different than the order of the disease on the heatmap. Even when I add on the Heatmap the option column_dend_reorder=FALSE... Is there any way to keep the order of the annotations fixed, the same as Clinical_data$Disease?

annotation inside heatmap annotation plotted outside heatmap with "plot(column_ha)"

As you can see the ordering on the disease annotation changes when is plotted inside heatmap or outside. On the bottom image i just plotted plot(column_ha) separately.

dendrogram heatmapannotations r heatmap complexheatmap

0 answers

No answers yet.

Log in to answer this question.