Spacing between plots

how to add space between 2 plots in shiny

For vertical space you could use one or more calls of br, e.g.,

mainPanel(
     plotOutput("plot1"),
     br(),
     br(),
     plotOutput("plot2")
)
1 Like

how to remove space between two plots in shiny?

I guess:

output$rawData <- renderPlot({
    par(mfrow = c(4, 1), mar = c(0,4,0,2), oma = c(4,0,4,0))
    plot(1:10,10:1,xaxt='n', ann=FALSE)
    plot(1:10,10:1, xaxt='n', ann=FALSE)
    plot(1:10,10:1, xaxt='n', ann=FALSE)
    plot(1:10,10:1, xaxt='n', ann=FALSE)
})

You could also try changing the mai argument to par.

Many years ago I wrote a blog post about spacing multi-panel plots in base R but it was not in the context of shiny. Subsequently, I've switched to ggplot2 so I don't have any experience using base R plots in shiny.