Hi! You can use ggplotify
and patchwork
. Here a reproducible example. It doesn't collect the legends though..
# load libraries
library(ggplot2)
library(ggplotify)
library(pheatmap)
library(patchwork)
# create random dataframe
df = data.frame(matrix(rnorm(20), nrow=10))
# save plots
p1 <- as.ggplot(pheatmap(df))
p2 <- as.ggplot(pheatmap(df))
# use patchwork to arrange them together
p1 + p2