我已经试过了:

output$plot <- renderPlot({
  getPlot()
}, width=input$plotX, height=input$plotY) # referring to two numericInput boxes

但是我得到这个错误:



帮助文本建议我使用函数,并且在这些函数中我可以引用反应性值,等等。但是这样做之后,我仍然遇到相同的错误...

有没有一种方法允许用户根据他们输入到应用程序中的值来调整绘图大小?

最佳答案

您可以使用shiny:::exprToFunction将反应值包装到函数中。

例如,

output$plot <- renderPlot({
  getPlot()
}, width=exprToFunction(input$plotX),
   height=exprToFunction(input$plotY)))

应该可以。

10-08 08:21
查看更多