使用bootstrap在Shiny中动态并排绘图的数量

使用bootstrap在Shiny中动态并排绘图的数量,r,shiny,R,Shiny,我曾经在我闪亮的应用程序中生成动态数量的绘图 问题是,我需要图以响应的方式并排填充,而不是相互下方:即动态使用可用的引导列 我试着沿着声称这样做的页面往下看,但我无法让它正常工作,也没有遵循代码(例如,plotOutput和renderPlot的位置似乎很奇怪) 我使用后一种方法成功地使响应网格正常工作,但图形没有出现在页面上(它们出现在RStudio控制台的图像窗口中) 我已经搜索过了,但在响应网格上找不到更多关于动态绘图数量的信息。我需要使用基本图形,并且不希望使用layout设置整个绘图空

我曾经在我闪亮的应用程序中生成动态数量的绘图

问题是,我需要图以响应的方式并排填充,而不是相互下方:即动态使用可用的引导列

我试着沿着声称这样做的页面往下看,但我无法让它正常工作,也没有遵循代码(例如,
plotOutput
renderPlot
的位置似乎很奇怪)

我使用后一种方法成功地使响应网格正常工作,但图形没有出现在页面上(它们出现在RStudio控制台的图像窗口中)

我已经搜索过了,但在响应网格上找不到更多关于动态绘图数量的信息。我需要使用基本图形,并且不希望使用
layout
设置整个绘图空间,因为我已经在使用
layout
在每个主绘图中绘制多个绘图

下面是从第一个链接到绘图动态数字的代码。我希望这些图能够用相应数量的行并排填充

max_plots <- 12

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(
        headerPanel("Dynamic number of plots"),
        sidebarPanel(
            sliderInput("n", "Number of plots", value=1, min=1, max=5)
        ),
        mainPanel(
            # This is the dynamic UI for the plots
            uiOutput("plots")
        )
)

# Define server logic required to draw a histogram
server <- function(input, output) {
    # Insert the right number of plot output objects into the web page
    output$plots <- renderUI({
        plot_output_list <- lapply(1:input$n, function(i) {
            plotname <- paste("plot", i, sep="")
            plotOutput(plotname, height = 280, width = 250)
        })
        # Convert the list to a tagList - this is necessary for the list of items
        # to display properly.
        do.call(tagList, plot_output_list)
    })
    # Call renderPlot for each one. Plots are only actually generated when they
    # are visible on the web page.
    for (i in 1:max_plots) {
        # Need local so that each item gets its own number. Without it, the value
        # of i in the renderPlot() will be the same across all instances, because
        # of when the expression is evaluated.
        local({
            my_i <- i
            plotname <- paste("plot", my_i, sep="")

            output[[plotname]] <- renderPlot({
                plot(1:my_i, 1:my_i,
                     xlim = c(1, max_plots),
                     ylim = c(1, max_plots),
                     main = paste("1:", my_i, ".  n is ", input$n, sep = "")
                )
            })
        })
    }
}

# Run the application
shinyApp(ui = ui, server = server)

max\u plots您可以使用
flowLayout
而不是
tagList