【问题标题】:Altering the height of a wellpanel in Shiny在 Shiny 中改变井板的高度
【发布时间】:2015-12-16 05:16:57
【问题描述】:

我的闪亮可视化顶部有一个不错的wellpanel,看起来不错:

...但是我对实际控件上方和下方的所有额外灰色空间感到恼火!我想删除这个不必要的空间。我的行比它需要的高了 50%,我不确定 Shiny 为什么/如何这样调整它的大小。

是否有任何具有 css / html / Shiny 技能的人能够指出我正确的方向,关于如何修改这个?到目前为止,我的尝试都没有成功。

下面是代码:

shinyUI(fluidPage(


  fluidRow(  
    column(12,
           wellPanel(              
             tags$div(class = "row",
                      tags$div(class = "span"),
                      tags$div(class = "span1", h1(numericInput(inputId="num", label="ID", value=NaN))),
                      tags$div(class = "span2", h1(sliderInput(inputId="age", "Age Range", min=32, max=99, value=c(32, 99), step=1))),
                      tags$div(class = "span1", h1(radioButtons(inputId="gender", "Gender", c("combined" = 0, "male" = 1, "female" = 2), inline=FALSE))),
                      tags$div(class = "span1", h1(textOutput("text")))
             )
           ))),  



  fluidRow(   


    column(4,
           plotOutput("some_plot_not_shown"))

)))

感谢您阅读本文。

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    您可以更改填充:

    library(shiny)
    runApp(
      list(ui = fluidPage(           
        wellPanel(              
        tags$div(class = "row",
                 tags$div(class = "span"),
                 tags$div(class = "span1", h1(numericInput(inputId="num", label="ID", value=NaN))),
                 tags$div(class = "span2", h1(sliderInput(inputId="age", "Age Range", min=32, max=99, value=c(32, 99), step=1))),
                 tags$div(class = "span1", h1(radioButtons(inputId="gender", "Gender", c("combined" = 0, "male" = 1, "female" = 2), inline=FALSE))),
                 tags$div(class = "span1", h1(textOutput("text")))
        )
      , style = "padding: 5px;")
      , wellPanel(              
        tags$div(class = "row",
                 tags$div(class = "span"),
                 tags$div(class = "span1", h1(numericInput(inputId="num1", label="ID", value=NaN))),
                 tags$div(class = "span2", h1(sliderInput(inputId="age1", "Age Range", min=32, max=99, value=c(32, 99), step=1))),
                 tags$div(class = "span1", h1(radioButtons(inputId="gender1", "Gender", c("combined" = 0, "male" = 1, "female" = 2), inline=FALSE))),
                 tags$div(class = "span1", h1(textOutput("text1")))
        )
        , style = "padding: 45px;")
      )
           , server = function(input, output, session){
    
           }
           )
      )
    

    【讨论】:

      【解决方案2】:

      我认为您在添加 columns 时尝试使用 spans 确实是您所追求的——试试这个:

      shinyUI(fluidPage(
        fluidRow(
          column(12,
            fluidRow(
              wellPanel(
                fluidRow(
                  column(3, h1(numericInput(inputId="num", label="ID", value=NaN))),
                  column(3, h1(sliderInput(inputId="age", "Age Range", min=32, max=99, value=c(32, 99), step=1))),
                  column(3, h1(radioButtons(inputId="gender", "Gender", c("combined" = 0, "male" = 1, "female" = 2), inline=FALSE))),
                  column(3, h1(textOutput("text")))
                )
              ) # End wellPanel
            )
          )
        ),
        fluidRow(
          column(4, plotOutput("some_plot_not_shown"))
        )
      ))
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-03-05
        • 2016-04-19
        • 2023-03-24
        • 2018-05-12
        • 2020-02-23
        • 1970-01-01
        • 2020-08-14
        相关资源
        最近更新 更多