R TabsetPanel未将整个页面填满
我正在尝试创建一个使用tabsetPanel的闪亮应用程序,但是当我创建选项卡时,应用程序中的内容不再填满窗口的整个空间,并在输出的右侧和下方留下巨大的白色间隙。下面是一个非常基本的例子。没有标签,这个应用程序就像一个流动的页面一样完美,但对于我正在做的工作,我需要将它拆分为多个标签 一个简单的例子:R TabsetPanel未将整个页面填满,r,tabs,shiny,R,Tabs,Shiny,我正在尝试创建一个使用tabsetPanel的闪亮应用程序,但是当我创建选项卡时,应用程序中的内容不再填满窗口的整个空间,并在输出的右侧和下方留下巨大的白色间隙。下面是一个非常基本的例子。没有标签,这个应用程序就像一个流动的页面一样完美,但对于我正在做的工作,我需要将它拆分为多个标签 一个简单的例子: `library(shiny) # Define UI for application that draws a histogram ui <- fluidPage( # Applica
`library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
mainPanel(
tabsetPanel(
tabPanel("Test",
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)),
#Create second tab just for demonstration
tabPanel("Second Test", h3("Test")
))))
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
{ "example second tab" }
}
# Run the application
shinyApp(ui = ui, server = server) `
`库(闪亮)
#为绘制直方图的应用程序定义UI
ui这里有一个横跨整个宽度的:
library(shiny)
ui <- fluidPage(
titlePanel("Title"),
tabsetPanel(
tabPanel(
"Test",
sidebarLayout(
sidebarPanel(
sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30)
),
mainPanel(
plotOutput("distPlot")
)
)
),
tabPanel("Second Test", h3("Test"))
)
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
{ "example second tab" }
}
shinyApp(ui = ui, server = server)
库(闪亮)
ui如果你想调整选项卡集面板的宽度和高度,这篇文章可能会有帮助:太好了,谢谢!我不知道这是我的错。