I am producing two graphs.
Right now they are showing up in two different panels (tabs)
ui.r
mainPanel(
tabsetPanel(
tabPanel("Summary", dataTableOutput("dis")),
tabPanel("Plot", plotOutput("plot1")),
tabPanel("Plot", plotOutput("plot2"))
)
)
server.r
output$plot1 <- renderPlot({
Plot1
})
output$plot2 <- renderPlot({
Plot1
})
I am wondering how can i show these graphs one below the other in the same panel, and not two different panels like how it is now. Thanks folks for helping.
You can wrap them in a fluidRow
or just list them inside the same tabPanel
shinyApp(
shinyUI(
fluidPage(
mainPanel(
tabsetPanel(
tabPanel("Summary", dataTableOutput("dis")),
tabPanel("Plot",
# fluidRow(...)
plotOutput("plot1"),
plotOutput("plot2")
)
)
)
)
),
shinyServer(function(input, output) {
output$plot1 <- renderPlot({
plot(1:10, 1:10)
})
output$plot2 <- renderPlot({
plot(1:10 ,10:1)
})
output$dis <- renderDataTable({})
})
)
Wrapping them in a fluidRow
provides easy control over individual plot attributes like widths for example,
tabPanel("Plot",
fluidRow(
column(8, plotOutput("plot1")),
column(12, plotOutput("plot2"))
))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With