发布
社区首页 >问答首页 >如何在闪亮的平板之间消除空间?

如何在闪亮的平板之间消除空间?
EN

Stack Overflow用户
提问于 2022-09-28 01:29:29
回答 1查看 39关注 0票数 0

这是我闪亮的应用程序。

我在表面板下创建了一个新的表面板。

我没有使用像br()和hr()这样的命令,但是它们之间存在差距。

有没有办法缩小或消除两者之间的差距?

EN

回答 1

Stack Overflow用户

发布于 2022-09-28 18:31:54

猜测使用的库和样式,下面是一个不同布局组合的示例(navbar +侧栏+选项卡、navbar +选项卡、navbar + navbar)。

您的例子似乎是嵌套的Navbar,这可能不是最好的方法,但它可以工作。注意内联样式:style='margin-top: -21px'

代码语言:javascript
代码运行次数:0
复制
#install.packages("shinythemes")
#https://shiny.rstudio.com/articles/tabsets.html
#https://rstudio.github.io/shinythemes/

library(shiny)
library(shinythemes)
# Define UI for random distribution app ----
ui <- navbarPage(
  theme = shinytheme("flatly"),
  "CHIP",
  tabPanel("Plot",
           sidebarLayout(
             # Sidebar panel for inputs ----
             sidebarPanel(
               radioButtons(
                 "dist",
                 "Distribution type:",
                 c(
                   "Normal" = "norm",
                   "Uniform" = "unif",
                   "Log-normal" = "lnorm",
                   "Exponential" = "exp"
                 )
               ),
               
               br(),
               sliderInput(
                 "n",
                 "Number of observations:",
                 value = 500,
                 min = 1,
                 max = 1000
               )
               
             ),
             mainPanel(tabsetPanel(
               type = "tabs",
               tabPanel("SubA1", plotOutput("plot")),
               tabPanel("SubA2", tags$p("In subA2")),
               tabPanel("SubA3", tags$p("In subA3"))
             ))
           )),
  tabPanel(
    "SubTabs",
    tabsetPanel(
      type = "tabs",
      tabPanel("SubB1", tags$p("In subB1")),
      tabPanel("SubB2", tags$p("In subB2")),
      tabPanel("SubB3", tags$p("In subB3"))
    )
  ),
  tabPanel("SubNav", style='margin-top: -21px',
   
   navbarPage("SubNav",
     tabPanel("SubNav1", tags$p("In SubNav1")),
     tabPanel("SubNav2", tags$p("In SubNav2")),
     tabPanel("SubNav3", tags$p("In SubNav3"))
   )
  )
)
server <- function(input, output) {
  d <- reactive({
    dist <- switch(
      input$dist,
      norm = rnorm,
      unif = runif,
      lnorm = rlnorm,
      exp = rexp,
      rnorm
    )
    
    dist(input$n)
  })
  output$plot <- renderPlot({
    dist <- input$dist
    n <- input$n
    
    hist(
      d(),
      main = paste("r", dist, "(", n, ")", sep = ""),
      col = "#75AADB",
      border = "white"
    )
  })
  
}
shinyApp(ui, server)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73875300

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档