简体   繁体   中英

Flexible height of plot in shiny app

I´m searching for a method to change the height parameter in plotOutput() depending on an input$.. value.

Any suggestions?

Samuel

Here you go:

library(shiny)

shinyApp(
  ui = fluidPage(
    numericInput("height", "height", 300),
    plotOutput("plot", height = "auto")
  ),

  server = function(input, output, session) {
    output$plot <- renderPlot({
      plot(1:10)
    },
    height = function(x) input$height)
  }
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM