【问题标题】:Make space between title and other items in R (Shiny App)在 R (Shiny App) 中的标题和其他项目之间留出空间
【发布时间】:2023-03-07 18:34:02
【问题描述】:

如何更改标题的字体和大小并在标题和其他项目之间添加一些空格?

ui<-navbarPage(Title="Intervals",
              tabPanel("Data Import",
              sidebarLayout(sidebarPanel( fileInput("file","Upload your 
              CSV",multiple = FALSE),
              tags$hr(),
              h5(helpText("Select the read.table parameters below")),
              checkboxInput(inputId = 'header', label = 'Header', value = 
              FALSE),
              checkboxInput(inputId = "stringAsFactors", "stringAsFactors", 
              FALSE),
              radioButtons(inputId = 'sep', label = 'Separator', 
              choices = c(Comma=',',Semicolon=';',Tab='\t', Space=''), selected 
               = ',')),
              mainPanel(uiOutput("tb1")) ) ),        
              tabPanel("95% Continious RI",
               sidebarLayout(sidebarPanel(
                              uiOutput("model_select"),
                              uiOutput("var1_select"),
                              uiOutput("rest_var_select")),
                              mainPanel( helpText("Selected variables and Fitted values"),
                                         verbatimTextOutput("other_val_show")))),
                  tabPanel("Model Summary", verbatimTextOutput("summary")), 
                  tabPanel("Scatterplot", plotOutput("scatterplot")))

【问题讨论】:

    标签: css r shiny


    【解决方案1】:

    您可以按如下方式添加自定义 CSS:

    tags$head(tags$style(HTML('.navbar-brand {width: 300px; font-size:35px; text-align:center;}')))               )
    

    这将使您的示例如下所示:

    您可能想稍微调整一下数字以使其符合您的喜好。下面给出了重现上面图像的代码。希望这会有所帮助!

    ui<-navbarPage("Intervals",
                   tabPanel("Data Import",
                            sidebarLayout(sidebarPanel( fileInput("file","Upload your 
                                                                  CSV",multiple = FALSE),
                                                        tags$hr(),
                                                        h5(helpText("Select the read.table parameters below")),
                                                        checkboxInput(inputId = 'header', label = 'Header', value = 
                                                                        FALSE),
                                                        checkboxInput(inputId = "stringAsFactors", "stringAsFactors", 
                                                                      FALSE),
                                                        radioButtons(inputId = 'sep', label = 'Separator', 
                                                                     choices = c(Comma=',',Semicolon=';',Tab='\t', Space=''), selected 
                                                                     = ',')),
                                          mainPanel(uiOutput("tb1")) ) ),        
                   tabPanel("95% Continious RI",
                            sidebarLayout(sidebarPanel(
                              uiOutput("model_select"),
                              uiOutput("var1_select"),
                              uiOutput("rest_var_select")),
                              mainPanel( helpText("Selected variables and Fitted values"),
                                         verbatimTextOutput("other_val_show")))),
                   tabPanel("Model Summary", verbatimTextOutput("summary")), 
                   tabPanel("Scatterplot", plotOutput("scatterplot")),
                   tags$head(tags$style(HTML('.navbar-brand {width: 300px; font-size:35px; text-align:center;}')))
    )
    
    server <- function(input,output) {}
    
    shinyApp(ui,server)
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-03
    • 2021-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多