本文介绍了如何删除与 Shiny 控件小部件的标签相对应的像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于绘图目的,我需要将以下两个小部件排列为一组,并需要删除第一个小部件下方的空白区域.非常感谢任何帮助.

For plotting purposes, I need to arrange following two widgets as a group and need to remove the blank space below the first widget. Any help is greatly appreciated.

library(shiny)
plotvars <- c("Cars","Book stores")
ui <- fluidPage(
   sidebarPanel(
      selectInput('plot1xvar', 'Plot 1 - X & Y Variables', plotvars,plotvars[1]),
      selectInput('plot1yvar', '', plotvars,plotvars[2])
   ),
   mainPanel()
)
server <- shinyServer(function(input,output){})
shinyApp(ui, server)

PS:我遇到了在下拉列表中修改字体大小、字体大小、将两个小部件保存在一个块中(即 display:inline-block)等的链接,但与它无关.

PS: I came across links to modify font size, font size in a drop down list, keeping two widgets in a single block (i.e.,display:inline-block),etc, but not with respect to it.

推荐答案

这将删除标签并修改边距:

This removes the label and modifies the margins:

    library(shiny)
    plotvars <- c("Cars","Book stores")
    ui <- fluidPage(
            tags$head(
                    tags$style(
                            HTML(
                                    ".form-group{
                                            margin-bottom: 0px;
                                    }
                                    .selectize-control{
                                            margin-bottom: 0px;
                                    }"
                            )
                    )
            ),
            sidebarPanel(
                    selectInput('plot1xvar', 'Plot 1 - X & Y Variables', plotvars,plotvars[1]),
                    selectInput('plot2yvar', label = NULL, plotvars,plotvars[2])
            ),
            mainPanel()
    )
    server <- shinyServer(function(input,output){})
    shinyApp(ui, server)

这篇关于如何删除与 Shiny 控件小部件的标签相对应的像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 16:49