侧边栏内的几个面板有光泽

时间:2016-03-21 14:02:17

标签: r shiny sidebar

我正在shiny建立我的第一个应用。要解决的问题是这样的。 我ui

shinyUI(fluidPage(

  # Application title
  titlePanel("My"),

  # Sidebar with a slider input for number of bins
  sidebarLayout(
    sidebarPanel("Variables",
      sliderInput("bins",
                  "Number of circles:",
                  min = 1,
                  max = 50,
                  value = 30),

      sliderInput("bins",
                  "Number of triangels:",
                  min = 1,
                  max = 50,
                  value = 1)
    ),


    # Show a plot of the generated distribution
    mainPanel(tabsetPanel(
      tabPanel("Data", plotOutput("distPlot")),
      tabPanel("Data1", textOutput("text1")),
      tabPanel("Data2", plotOutput("distPlot1")))

    )
  )
))

server

shinyServer(function(input, output) {

  output$distPlot <- renderPlot({

    # generate bins based on input$bins from ui.R
    x    <- faithful[, 2]
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    # draw the histogram with the specified number of bins
    hist(x, breaks = bins, col = 'darkgray', border = 'white')

  })

  output$distPlot1 <- renderPlot({
    x    <- faithful[, 2]
    plot(density(x))
  })

  output$text1 <- renderText({
    "Hello mother"
  })

})

关注的问题ui部分。我想在sidebarPanel - 三角形和圆形中放置2个面板,类似于mainPanel中的Data, Data1, Data2。 感谢您的评论!

0 个答案:

没有答案