jokergoo / ComplexHeatmap

Make Complex Heatmaps
https://jokergoo.github.io/ComplexHeatmap-reference/book/
Other
1.25k stars 220 forks source link

Draw border around aligned heat maps #1190

Open flde opened 4 days ago

flde commented 4 days ago

Hello @jokergoo,

Again many thanks for this awesome tool! I am aligning multiple heatmaps vertically. Everything works very nice but I would like to have a single border around the aligned heatmaps. A simple example code would be as follows:

mat <- matrix(rnorm(100), 10) border <- TRUE

Create heatmaps

heatmap_list <- list( Heatmap(mat, name="GTC_1", show_heatmap_legend=TRUE, show_row_names=FALSE, show_column_names=FALSE, border=border), Heatmap(mat, name="GTC_2", show_heatmap_legend=TRUE, show_row_names=FALSE, show_column_names=FALSE, border=border), Heatmap(mat, name="GTC_3", show_heatmap_legend=FALSE, show_row_names=FALSE, show_column_names=FALSE, border=border), Heatmap(mat, name="GTC_4", show_heatmap_legend=FALSE, show_row_names=FALSE, show_column_names=FALSE, border=border) )

combined_hm <- Reduce(%v%, heatmap_list) draw(combined_hm, gap=unit(0, "mm"))

download

Each slice has a border but I want to avoid the horizontal lines. I can achieve that with three distinct cell_fun calls for the top, middle and bottom heatmaps but that is not practical for large data sets.

I thought I could use decorate_heatmap_body after draw but I assumed that there will be a merged heatmap body. However, it seems that I can again only draw borders around the individual heatmaps.

Do you have any idea how I could draw a border around the combined heatmaps with or after draw?

Many thanks, Florian