0
總的來說,我的目標是在灰色框中包含一組UI元素。這純粹是一種審美的東西,我用sidebarPanel()
來試圖完成它。sidebarPanel沒有調整大小plotOutput
我在shiny
一個mainPanel
內使用sidebarPanel()
時碰到對我的UI佈局的問題。它看起來好像sidebarPanel()
更改頁面上的圖和其他UI元素之間的間距。我已經包含下面重複的例子:
library(shiny)
library(ggplot2)
server <- function(input, output, session) {
###Outputting data exploration graph
output$graphMain <- renderPlot({
ggplot(data=mtcars) + geom_histogram(aes(x=hp))
})
}
ui <- pageWithSidebar(
headerPanel = NULL,sidebarPanel = NULL,
mainPanel = mainPanel(
tabsetPanel(
type = "pills",
tabPanel("My Panel",
sidebarPanel(width=12 ####Problematic sidebarPanel
, checkboxInput(inputId="checkbox1",label="Check box 1")
),
plotOutput("graphMain", width = "95%")
,checkboxInput(inputId="checkbox2",label="Check Box 2")
)
)
)
)
shinyApp(ui = ui, server = server, options = list(launch.browser = T))
我挖遠一點到這一點,並注意到這個問題似乎侷限於與以重疊plotOutput()
是唯一的。例如,我試圖用dataTableOutput()
替換我的,問題就消失了。
我的問題是:有沒有快速解決這個問題?我知道我可以通過添加一堆br()
來修復它,但我想避免這種情況。另外,如果有更好的方法將一組輸入放入灰色框中,請讓我知道!
完美,偉大工程! –