See ComplexHeatmap
• 0 views
•
link
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.
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)
See ComplexHeatmap
Log in to answer this question.