Hi @jokergoo, this is very similar to #864 , but instead when using column_km to split groups with k-means clustering. I get 6 groups, and would like the swing the groups on their parent branches to re-order from c(6, 5, 4, 3, 2, 1) to c(6, 1, 2, 4, 3, 5).
In general, to make this reproducible I am setting the seed first, but the issue is related to the structure of the list object I get from column_dend(drawn)
Error: `cluster_columns` should be a logical value, a clustering function or a
clustering object.
Example below
library(ComplexHeatmap)
m = t(USArrests[c(1, 6, 13, 20, 23), ])
# set.seed(3)
hm <- Heatmap(m, column_km = 2)
drawn <- draw(hm)
# col_dend <- as.dendrogram(column_dend(drawn))
col_dend <- column_dend(drawn)
# set.seed(3)
hm <- Heatmap(m, cluster_columns = col_dend[c(2, 1)])
It is easy to reorder the list, but I cannot figure out a way to feed it back to the constructor or drawn object.
Hi @jokergoo, this is very similar to #864 , but instead when using
column_kmto split groups with k-means clustering. I get 6 groups, and would like the swing the groups on their parent branches to re-order fromc(6, 5, 4, 3, 2, 1)toc(6, 1, 2, 4, 3, 5).In general, to make this reproducible I am setting the seed first, but the issue is related to the structure of the list object I get from
column_dend(drawn)Example below
It is easy to reorder the list, but I cannot figure out a way to feed it back to the constructor or drawn object.