library(shiny)
ui <- fluidPage(
titlePanel("Hello"),
sidebarLayout(
sidebarPanel("Hello SideBar"),
mainPanel("Hello MainPanel")
)
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
仅通过目视,我现在就知道我的侧边栏面板大约占据了屏幕宽度的 33%。知道如何减少侧边栏的宽度以使主面板更大吗?
最佳答案
sidebarPanel
有一个宽度参数
width: The width of the sidebar. For fluid layouts this is out of 12 total units; for fixed layouts it is out of whatever the width of the sidebar's parent column is.
默认宽度为 4,这证实了您的目测估计 4/12 是三分之一。因此,要使其成为当前宽度的 1/2,您可以这样做:
ui <- fluidPage(
titlePanel("Hello"),
sidebarLayout(
sidebarPanel("Hello SideBar", width=2),
mainPanel("Hello MainPanel")
)
)
关于r - 如何减小 R Shiny Web 应用程序中侧边栏面板的宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54963915/