Replies: 1 comment 1 reply
-
I have to say it is a little bit confusing for the design of the package. Because a heatmap can have column annotations as well as row annotations. Row annotations legends are grouped with heatmap legends, which means, If you want to always group annotation legends and heatmap legends separately, you can set draw(Heatmap(hmap_bt,
name = "Z-score",
col = colorRamp2(c(-2, 0, 2), c("#6DBCC3", "white", "#8B3A62")),
show_column_names = FALSE,
show_column_dend = FALSE,
column_km = 3,
left_annotation = rowAnnotation(Case = hmap[, c(13:14)]$malig,
Type = hmap[, c(13:14)]$type,
col = list(Case = c("Ctrl" = "#D1B551", "Tumor" = "#678F53"),
Type = c("Ctrl" = "#D1B551", "Cell_type1" = "green", "Cell_type2" = "blue")),
annotation_legend_param = list(
Case = list(
title_gp = gpar(fontsize = 16,
fontface = "bold"),
labels_gp = gpar(fontsize = 16)),
Type = list(
title_gp = gpar(fontsize = 16,
fontface = "bold"),
labels_gp = gpar(fontsize = 16)))),
heatmap_legend_param = list(
legend_direction = "horizontal",
legend_width = unit(6, "cm")),
) ,
heatmap_legend_side = "bottom",
legend_grouping = "original"
) Another thing is there is a space between the bottom legend and the heatmap. They should be closer. I will improve it in the future. |
Beta Was this translation helpful? Give feedback.
-
Hi Zuguang Gu
Thank you for ComplexHeatmap, it is very useful. I am relatively new to programming, so my apologies for this basic question.
I am having problems figuring out how to place legend and annotations differently.
Lets say I have these data
And used this script
Which gives this:
I am trying to achieve this graphical output:
This question is also asked on StackOverflow.
Hope that you can help.
Thank you in advance.
Best
Christian
Beta Was this translation helpful? Give feedback.
All reactions