How to achieve click and brush with plotly in R?

https://shiny.rstudio.com/gallery/plot-interaction-selecting-points.html
Just like this. But plotly use PlotlyOutput(), not PlotOutput(), so it could only catch the coordinate of the click. How to show the detailed information after the click?


In the example,

event.data <- event_data(“plotly_selected”, source = “subset”)

gave you the selected point and you can use event.data$x and event.data$y to subset your dataframe to get desired detail

Thank you very much! Your answer is very helpful.