[英]R Shiny two rows by two columns
我想在兩行兩列布局中放置四個圖。 下面的代碼返回兩列一列。 如何添加第二列?
任何幫助表示贊賞。
ui <- shinyUI(
fluidRow(
column(6,
plotOutput(outputId = "hist1")
),
column(6,
plotOutput(outputId = "hist2")
)
)
)
server <- function(input,output){
output$hist1 <- renderPlot({
hist(rnorm(100,50,5))
})
output$hist2 <- renderPlot({
hist(rnorm(100,75,5))
})
output$hist3 <- renderPlot({
hist(rnorm(100,100,5))
})
output$hist4 <- renderPlot({
hist(rnorm(100,125,5))
})
}
runApp(list(ui = ui, server = server))
brittenb在評論中的回答:需要添加fluidPage()
。
ui <- shinyUI(
fluidPage(
fluidRow(
column(6,
plotOutput(outputId = "hist1")
),
column(6,
plotOutput(outputId = "hist2")
)
),
fluidRow(
column(6,
plotOutput(outputId = "hist3")
),
column(6,
plotOutput(outputId = "hist4")
)
)
)
)
server <- function(input,output){
output$hist1 <- renderPlot({
hist(rnorm(100,50,5))
})
output$hist2 <- renderPlot({
hist(rnorm(100,75,5))
})
output$hist3 <- renderPlot({
hist(rnorm(100,100,5))
})
output$hist4 <- renderPlot({
hist(rnorm(100,125,5))
})
}
runApp(list(ui = ui, server = server))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.