Boxplot annotation per cluster and column using ComplexHeatmap
Hi, I am trying to add boxplot annotations to my heatmap similar as in post1 but with one boxplot per cluster. For a single column heatmap it works as intended:
library(ComplexHeatmap)
ha = HeatmapAnnotation(summary=anno_summary(height=unit(4,"cm")))
v=rnorm(50)
Heatmap(v,name="mat",top_annotation = ha,width=unit(2,"cm"),km=2)
However, when I have two or more columns I get an error or I get the result as described in the above post.
ha = HeatmapAnnotation(summary=anno_summary(height=unit(4,"cm")))
v=cbind(rnorm(50),rnorm(50,1))
Heatmap(v,name="mat",top_annotation = ha,width=unit(2,"cm"),km=2)
Error: number of observations in top annotation should be as same as ncol of the matrix.
Please advise.
• 2,318 views
•
link
0 answers
No answers yet.
Log in to answer this question.
I think those examples should help:
Thanks for sharing these. Having a hard time understanding how these annotation functions are written. Any more detailed tutorials on those (beyond index, k, m)? The first link you provided uses two separate heatmaps and generates one boxplot per row of each heatmap. I am looking to generate a boxplot for each column and k-means cluster. Not sure how to implement this based on the available information.