我想利用我的情节的高度反应性,因为有时我只需要绘制一张图,有时需要绘制两到三张图。这是我的代码:
output$myplot<-renderPlot({
plot_to_draw <- data[data$code==input$code,"River_name"]
plot(plot_to_draw)
number_of_plot <- length(plot_to_draw)
},height = 500*number_of_plot)
Run Code Online (Sandbox Code Playgroud)
但是 Shiny 只读取一次情节的高度,因此它不是反应性的。谢谢您的回答 !
我终于找到了解决办法;
server.R
output$myplot<-renderPlot({
plot_to_draw <- data[data$code==input$code,"River_name"]
plot(plot_to_draw)
number_of_plot <- length(plot_to_draw)
},height = function(){500*number_of_plot})
ui.R
plotOutput(outputId="myplot",height = "auto")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4185 次 |
| 最近记录: |