grid – Created a list of heatmaps but can visualize/save/seperate individually

I’m creating a list of heatmaps (baseplot package) from a list of matrices (protein expression data).
I used lapply and it looks like this

Heatgraphs <- lapply(names(splitmatrix),
                     function(x) heatmap(splitmatrix[[x]],
                                         Rowv = NA,
                                         Colv = NA, 
                                         col=rev(brewer.pal(9,"Blues")), 
                                         scale = "column", 
                                         main= x))

There should be a total of 19 heatmaps generated, which I can see individually on the plots tab, and the environment has Heatgraphs created wuth a list of 19. I tried to use par(mfrow=c(5,4)) before running lapply but it refuses to show them in grid. I could not find how to change the graphs to grobs as to be able to use gridExtra. I also can’t seem to figure out how to seperate the heatmaps to seperate graphs in the environment.

I need the heatmaps to print either on one page, or have them seperated so I can then parse them into one page.

Read more here: Source link