Stacking plots together from a list, and displaying in a scroll box?

I have a list of data frames. For each element/df in that list, I want to make a plot which is to be deposited into a separate list.

I want to stack all the plots one on top of another using shiny - preferably in a scrollbox. I have a minimal reprex below (without using Shiny) illustrating what my list of plots looks like. For just a handful I might use patchwork or the like to stack them, but in reality I may have 100 plots in my list.

How could I display them in a scrollbox in shiny?

library(ggplot2)

#Make a list of 4 data frames, each derived from 'mtcars' (different values for downstream verification)
mylist <- list(MT1 <- mtcars[,1:2],
               MT2 <- MT1*2,
               MT3 <- MT2+80,
               MT4 <- log2(MT1))

#Make an empty list that the plots will go into
plot_list <- list()

#Make plots for all elements of 'mylist', deposit into 'plot_list'
for(i in seq_along(mylist)){
  myplot <- ggplot(mylist[[i]], aes(x=mpg, y=cyl)) + geom_point()
  plot_list[[i]] <- myplot
}

Thanks!

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.