This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I reorder row clusters using complexheatmap

I want to change order of clusters on the heatmap using Complex Heatmap package and I used pearson distance method and average method. When I cut the row dendrogram, cluster order is 1,3,2,4. How can I change it to this order :2,1,3,4

      clusters = dendextend::cutree(hx, k = 4)
      col_fun = colorRamp2(c(-2, 0, 2), c("blue", "white", "red"))
      split <- factordim.cl$clusters, levels =c(2,1,3,4))

      Heatmap(z, split = split, show_row_names = FALSE, name = "log2(FC)", col = col_fun)
r complexheatmap

1 answer

Ready made solution for you: A: Complex Heatmap: Changing order of clusters

Kevin

the problem is solved. just need to add this parameter:

cluster_row_slices = FALSE

Yep, please also see the manual, it is outstandingly comprehensive.

Log in to answer this question.