使用plot_在flexdashboard中单击
是否有一种使用flexdashboard进行鼠标交互绘图的方法 在中国,这并不困难。我想保存鼠标点击,在闪亮的UI中我会使用:使用plot_在flexdashboard中单击,r,shiny,flexdashboard,R,Shiny,Flexdashboard,是否有一种使用flexdashboard进行鼠标交互绘图的方法 在中国,这并不困难。我想保存鼠标点击,在闪亮的UI中我会使用: mainPanel(plotOutput("scatterplot", click = "plot_click")) 在服务器中,您将拥有: df <- reactiveValues(Clicksdf = data.frame(clickx = numeric(), clicky = numeric())) 我可以在flexdashboard中这样做吗?编写代
mainPanel(plotOutput("scatterplot", click = "plot_click"))
在服务器中,您将拥有:
df <- reactiveValues(Clicksdf = data.frame(clickx = numeric(), clicky = numeric()))
我可以在flexdashboard中这样做吗?编写代码块,就像它是闪亮的UI和服务器一样:
---
title: "Untitled"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
plotOutput("plot1", click = "wt")
output$plot1 <- renderPlot({
plot(mtcars$mpg ~ mtcars$wt)
})
```
Column {data-width=350}
-----------------------------------------------------------------------
### Chart B
```{r}
renderText({
unlist(input$wt$x)
})
```
我把它标为被接受的答案。不幸的是,这是我的第一篇文章,所以我没有足够的声誉来提升它,但当我这样做的时候,我会回来并提升它。再次感谢!别担心。非常感谢。