Skip to main content

Align legends to each heatmap in a ComplexHeatmap with 2 heatmaps

I have created a ComplexHeatmap containing 2 Heatmaps, each with their own legend. The legend on the first Heatmap is continuous, whereas that of the second is discrete.

When I concatenate these Heatmaps vertically, and draw the HeatmapList, their legends are auto-aligned to the center of the plot. Is there any way I can have these legends positioned centered to the respective heatmaps and not to the center of the plot?

This is what I have:

Current_Image

Here's what I'd like to have:

Desired_Image

How can I go about solving this problem? I'd really like to avoid creating customized Legends if I can, but if that's what it takes, that works too.

Thank you in advance for any help/pointers!

Note: I tried adding the ComplexHeatmap tag, but it doesn't exist yet and I don't have the reputation to create new tags yet.

Ram RS
  • 2.5k
  • 11
  • 29