0
我已经使用grid.arrange
查看了SO上的所有解决方案,但它并没有真正实现我想要的。在网格中显示未知数量的图表RShiny
我们假设我有一个在RShiny的反应环境中生成的grobs列表。
我想创建一个mainPanel
其中那些图是2列(直到这一点,它的所有可行与grid.arrange
),但是,其中每个行对应一个fluidRow
元件。
这方面的一个准系统例子是
ui <- fluidPage(
titlePanel("TEST"),
sidebarPanel(width=3,
actionButton(inputId = 'launchCalcButton',label = 'Launch Calc')
),
mainPanel(
uiOutput("resultsPlotUI")
)
)
server <- function(input,output){
graphsList <- eventReactive(input$launchCalcButton, {
a <- lapply(1:10,function(i){
return(
ggplot(data = data.frame(a=rnorm(10),b=rnorm(10)),aes(x=a,y=b))
+geom_point()
)
})
return(a)
})
output$resultsPlot <- renderPlot({
do.call(grid.arrange,c(graphsList(),ncol=2))
})
output$resultsPlotUI <- renderUI({
fluidRow(
column(12,
plotOutput(
outputId = 'resultsPlot'
)
)
)
})
}
app = shinyApp(ui,server)
runApp(app)
所有图形最终挤压成一个单一的线,而我希望他们线之间进行分割。
感谢您的答案,但我想它使用默认的行高,并创建必要的UI新fluidRow的解决方案。 – Chapo