I'm working on a Shiny application. Part of it is to recommend to users a gallery of ML generated ggplot2 plots based on their own data (or example data from R packages). There will be at least 50 plots generated and displayed every for users to choose from, possibly many more. My problem is that all plots are displayed at one time, with huge waiting times. I would like to find a way to have them displayed one by one, as soon as one has been generated. In the simple example below, instead of all 4 plots showing at one time, I'd like to have them shown individually as soon as they're ready.
ui <- fluidPage(
fluidRow(
splitLayout(
style = "height: 160px; text-align:center",
plotOutput("Mosaic_Plot1"), plotOutput("Mosaic_Plot2"), plotOutput("Mosaic_Plot3"), plotOutput("Mosaic_Plot4")
),
splitLayout(
style = "height: 40px; text-align:center",
actionButton("mosEdit1", "Edit this plot"), actionButton("mosEdit2", "Edit this plot"), actionButton("mosEdit3", "Edit this plot"),
actionButton("mosEdit4", "Edit this plot")
)
)
)
server <- function(input, output, session) {
output$Mosaic_Plot1 <- renderPlot({ggplot(data = diamonds, aes(carat, price)) + geom_point()}, width = 280, height = 160)
output$Mosaic_Plot2 <- renderPlot({ggplot(data = diamonds, aes(x = color, y = price, color = color)) + geom_point() + geom_jitter()}, width = 280, height = 160)
output$Mosaic_Plot3 <- renderPlot({ggplot(data = diamonds, aes(carat)) + geom_histogram()}, width = 280, height = 160)
output$Mosaic_Plot4 <- renderPlot({ggplot(data = diamonds, aes(depth, table)) + geom_point()}, width = 280, height = 160)
}
shinyApp(ui, server)
I tried several options with embedded uiOutputs, fillPage, ... but nothing worked so far. Many thanks for any suggestions on how to make this work.
