闪亮的flowrow列白色空间

时间:2016-04-21 19:01:57

标签: r shiny whitespace

我有一个顶部横幅,我想分成两个独立的部分,代表两个不同的输入。为此,我创建了一个fluidRow并有两列,每列输入一列。但是,就像现在一样,列之间有一点白色空间,尽管偏移= 0.有没有办法删除这个空白区域,以便列立即彼此相邻?

colors = c("green","blue","red")
library(shiny)

ui <- fluidPage(

  tabsetPanel(
    tabPanel("Info",
             fluidRow( 
                   column(width = 6, offset = 0,
                      div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",
                          tags$h3("Section 1")
                      )
                   ),
                   column(width = 6, offset = 0,
                       div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",       
                          tags$h3("Section 2")
                       )
                   ) 
             ),
             fluidRow(
                   column(width = 6, offset = 0,
                   div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",       
                       selectInput(inputId = "color",label = "color:",
                                   choices = colors,
                                   selected = colors[2],
                                   multiple = FALSE)
                      )
                    ),
                   column(width = 6, offset = 0,
                          div(style = "height:50px;width:100%;background-color: #999999;border-style: solid;border-color: #000000",       
                              selectInput(inputId = "points",label = "Number of Points:",
                                          choices = c("30","60","90"),
                                          selected = "10",
                                          multiple = FALSE)                      )
                   )
             ),   
             br(),
             br(),
             fluidRow(
                   actionButton(inputId = "go",
                                label = "Update"
                   )
             ),
             fluidRow(
                   plotOutput("plot", width = "100%")
             )

    )
  )
)


server <- function(input, output,session) {

  data = eventReactive(input$go, {
    var1 = rnorm(isolate(as.numeric(input$points)),5)
    cat1 = c(rep("red",length(var1)/3),rep("blue",length(var1)/3),rep("green",length(var1)/3))
    data = cbind.data.frame(var1,cat1)
    plotdata = data[which(data$cat1 ==isolate(input$color)),] 
  }
  )

  output$plot = renderPlot({
    plotdata = data()
    plotcol = isolate(input$color)
    plot(plotdata$var1, col = plotcol) 
  })
}

shinyApp(ui = ui,server = server)

1 个答案:

答案 0 :(得分:24)

空格是列div的填充。要删除它,请使用

column(width = 6, offset = 0, style='padding:0px;', ...)