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%"
)
})
```