【发布时间】:2017-06-15 22:26:39
【问题描述】:
我是shinydashboard 的首次用户,但我无法理解页面上图表中框之间的填充是如何工作的。例如,下面示例中的填充非常混乱,并且准确地代表了我在工作中遇到的问题:
如何拉伸图表(最好将框之间的填充设置为 0)?
这是用于创建上述图像的代码:
library(shinydashboard)
header <- dashboardHeader()
sidebar <- dashboardSidebar(
sidebarMenu(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
)
)
body <- dashboardBody(
fluidRow(
column(
width = 4,
box(title = "Chart1",
plotOutput("distPlot")
)
),
column(
width = 6,
tabBox(
tabPanel(id = "tabBox1",
title = "Chart2",
plotOutput("distPlot2")
),
tabPanel(id = "tabBox2",
title = "Chart3",
plotOutput("distPlot3")
),
tabPanel(id = "tabBox3",
title = "Chart4",
plotOutput("distPlot4")
)
)
),
column(width = 2,
box(title = "Chart5",
plotOutput("distPlot5")
)
)
)
)
shinyApp(
ui = dashboardPage(header, sidebar, body),
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')
})
output$distPlot2 <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$distPlot3 <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$distPlot4 <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
output$distPlot5 <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
)
【问题讨论】:
标签: r shiny shinydashboard