如何在闪亮的选项卡面板和图形之间创建间距?

fai*_*nty 3 r graph shiny

我使用该tabsetpanel()函数为两个不同的图表创建选项卡。但是,我遇到了这样的问题:图表的标题非常靠近选项卡并且没有任何间距。它看起来像是被压在一起的,所以我想知道如何在选项卡面板和图表之间创建间距?我的左侧有一个闪亮的小部件,它控制右侧的图表。这是我的代码的示例:

tabPanel("Name",
   sidebarLayout(
     sidebarPanel(
       selectInput(
         <shiny widget coding is here>
       )
     ),
     mainPanel(
       tabsetPanel(
         tabPanel("graphname", plotlyOutput("graph1")),
         tabPanel("graphname2", plotlyOutput("graph2"))
       )
     )
   )
)
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,有 tabsetPanel,然后是带有图表的 tabpanels。但图表和 tabsetpanel 栏之间没有间距,如下所示:

我怎样才能解决这个问题?

sho*_*aco 6

br()快速而肮脏,在情节之前使用。br()是一个 HTML 换行符:

library(shiny)    
library(plotly)
runApp(list(
  ui = fluidPage(tabPanel("Name",
                sidebarLayout(
                  sidebarPanel(

                  ),
                  mainPanel(
                    tabsetPanel(
                      tabPanel("graphname", br(), plotlyOutput("graph1")),
                      tabPanel("graphname2",  plotlyOutput("graph2"))
                    )
                  )
                )
  )),
  server = function(input, output) {
    output$graph1 <- renderPlotly({
      plot_ly(mtcars)%>% layout(title = "With Space")
    })

    output$graph2 <- renderPlotly({
      plot_ly(mtcars)%>% layout(title = "Without Space")
    })

  }
))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述