在闪亮的面板上绘制两个图形,一个在另一个之下

Bri*_*ker 6 plot r shiny shiny-server

我正在制作两张图.

现在他们出现在两个不同的面板(标签)

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
 })
Run Code Online (Sandbox Code Playgroud)

我想知道如何在同一个面板中一个接一个地显示这些图形,而不是像现在这样的两个不同的面板.谢谢大家的帮助.

pic*_*ick 11

您可以将它们包装在一个fluidRow或只是将它们列在同一个中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({})
    })
)
Run Code Online (Sandbox Code Playgroud)

将它们包装在一起fluidRow可以轻松控制各个绘图属性,例如宽度,

tabPanel("Plot",
         fluidRow(
             column(8, plotOutput("plot1")),
             column(12, plotOutput("plot2"))
         ))
Run Code Online (Sandbox Code Playgroud)