2
http://rmarkdown.rstudio.com/authoring_shiny.html上的示例指示renderPlot
本身會將該圖繪製爲降價。我們如何獲得降價以允許互動,如點擊,刷子等,這些互動被宣佈爲隨後的plotOutput
步驟的一部分?Markdown中的交互式ggplot
與plotOutput
在shiny
這裏的互動示例 - http://shiny.rstudio.com/articles/plot-interaction.html。
代碼片段 -
```{r, echo = FALSE}
output[['Plot1']] = renderPlot(
ggplot(mtcars) + geom_point(aes(x = cyl, y = qsec))
)
renderPlot(
ggplot(mtcars) + geom_point(aes(x = cyl, y = wt))
)
print("renderPlot above. plotOutput below (which doesn't get rendered).")
renderUI({
plotOutput(
'Plot1',
brush = brushOpts(
id = 'Brush1'
),
dblclick = dblclickOpts(id = 'DblClick1'),
click = 'Click1',
height = "100%"
)
})
```