Question: Multiple Heatmap plot in one canvas with mfrow?
2
gravatar for Shicheng Guo
3.7 years ago by
Shicheng Guo8.0k
Shicheng Guo8.0k wrote:

Hi All,

Any solution to plot multiple heatmap in one page in R (heatmap.2 in gplots)? par(mfrow=c(2,2)) don't work. It will plot the heatmap in separate pages.

Thanks.

heatmap mfrow • 5.7k views
ADD COMMENTlink modified 3.7 years ago • written 3.7 years ago by Shicheng Guo8.0k
4
gravatar for Shicheng Guo
3.7 years ago by
Shicheng Guo8.0k
Shicheng Guo8.0k wrote:

I find the solution eventually, Anyway, share with others, hope it is helpful in your routine analysis. Also, I found gridGraphics and grid is very useful for complicated figure preparation.

library(gridGraphics)
library(grid)

grab_grob <- function(){
  grid.echo()
  grid.grab()
}

data<-read.table("heatmap.input.matrix.data.txt")

library(gplots)
gl <- lapply(1:ncol(data), function(i){
  heatmap.2(data.matrix(data[[i]]))
  grab_grob()
})

grid.newpage()
library(gridExtra)
grid.arrange(grobs=gl, ncol=5, clip=TRUE)
ADD COMMENTlink modified 3.7 years ago • written 3.7 years ago by Shicheng Guo8.0k
2

See ComplexHeatmap

ADD REPLYlink written 3.7 years ago by poisonAlien2.8k
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 2.3.0
Traffic: 1514 users visited in the last hour