I have a loop that produces multiple plots. The Minimal reprex below produces 5 plots. How can I combine all plots into one single plot - with 1 row? I think this would be like using patchwork like:
p1 / p2 / p3 / p4 / p5
How can I combine them into one plot
library(ggplot2)
library(patchwork)
mylist <- list()
mtcars_short <- mtcars[1:5,]
for(i in 1:nrow(mtcars_short)){
mydf <- mtcars[i,]
p <- ggplot(mydf, aes(x=mpg, y=carb)) + geom_point()
mylist[[i]] <- p
}
EDIT to mention that my real example has ~50 plots in a list. Can I use some method (grid.arrange /patchwork/etc) to make sure the plots are the exact same dimensions as stand-alone versions, but just all stacked on top of one another? I think in the past I've seen that combining ggplots from a list will squish everything down to an unreadable size.