ComplexHeatmap
ComplexHeatmap copied to clipboard
I want to remove the main body of heatmap
Please provide example datasets and the code you use. It will help me to understand your problem and help you!
help! I want to remove the main body of heatmap.Keep the cluster tree and comments at the top.What should I do
I guess you only want the dendrogram and the top annotation? Then you can do it in two steps:
- generate the clustering object:
set.seed(123)
m = matrix(rnorm(200), 20, 10)
hc = hclust(dist(t(m)))
- since you don't need the heatmap body but want to keep the dendrogram, you need to create a zero-row matrix:
m_zero = matrix(nrow = 0, ncol = 10)
Then creating the top annotation. Note here I move the annotation names to the left so that they will not overlap with the legend.
ha = HeatmapAnnotation(foo = 1:10, bar = anno_points(runif(10)),
annotation_name_side = "left")
And finally put everything together:
Heatmap(m_zero, top_annotation = ha, cluster_columns = hc)
Heatmap(m_zero, top_annotation = ha, cluster_columns = hc)
Thank you! ComplexHeatmap is too powerful!