My question is related to this one: http://stackoverflow.com/questions/13081310/combining-multiple-complex-plots-as-panels-in-a-single-figure
I also have a unsatisfactory solution based on the answer to the above questions.
I'd like a plot like this:
I use the following code for this figure:
library(gridGraphics) library(grid) grab_grob <- function(){ grid.grab() } drawGridHeatmap <- function(hm) { draw(hm) grab_grob() } gl <- lapply(list(hm.line+ha, hm.lc+ha.nolegend, hm.dna + ha.nolegend), drawGridHeatmap) grid.newpage() library(gridExtra) grid.arrange(grobs=gl, ncol=2, clip=TRUE)
where `hm.line` etc. are `Heatmap` instances and `ha` are `HeatmapAnnotation` instances as described in the ComplexHeatmap package.
I'm aware that ComplexHeatmap is intended to draw several related Heatmaps and cluster them together. But I'd like to show several heatmaps in a grid, cluster them by themselves but they should share a common legend. Is this somehow supported in the ComplexHeatmap package?
The solution that I use has the drawback that, before plotting the heatmaps to the grid, it first plots every single heatmap on its own. How can I supress the plotting when calling `draw` in the `drawGridHeatmap` function?
Sorry, when plotting two heatmaps with the genes with same ordering by complexheatmap, how i can put the same color scaling on the both heat maps? because one of my heat maps is darker in genes blocks =https://image.ibb.co/fbhVGo/Rplot311.png