Question: Combining ComplexHeatmap with other plot types
0
gravatar for my4
21 months ago by
my40
my40 wrote:

I have two plots that I want to place next to each other on a grid.  If they were both ggplot2 plots I'd just do something like this:

plot_grid(plot_a,plot_b,ncol=2)

using the cowplot package.

However, one of my plots I have created using the ComplexHeatmap package.  While the other is created with ggplot2.  That is:

> class(plot_a)
[1] "gg"     "ggplot"
> class(plot_b)
[1] "Heatmap"
attr(,"package")
[1] "ComplexHeatmap"

How can I combine these plots in a grid and more generally what is the recommended way of making a grid of plots of different types?

Thanks.

 

ggplot2 complexheatmap • 703 views
ADD COMMENTlink modified 21 months ago by Zuguang Gu100 • written 21 months ago by my40
Answer: Combining ComplexHeatmap with other plot types
2
gravatar for Zuguang Gu
21 months ago by
Zuguang Gu100
Germany
Zuguang Gu100 wrote:

You can use `grid.grabExpr()` to capture the output of ComplexHeatmap as a `grob` object and later you can arrange this `grob` object by other packages which do layout.

Note you need to explicitly use `draw()` on the heatmap object.

grob = grid.grabExpr(draw(Heatmap(...))) 

ADD COMMENTlink written 21 months ago by Zuguang Gu100

This was exactly what I was looking for.  Thank you!

ADD REPLYlink written 21 months ago by my40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 243 users visited in the last hour