I would like to fetch `nearPoints` using the data from a click event.

I have found the below snippet from the [Shiny webpage](https://shiny.rstudio.com/reference/shiny/latest/plotOutput.html) and it works fine as expected.

```
output$plot <- renderPlot({
  d <- data()
  plot(d$speed, d$dist)
})

output$plot_clickedpoints <- renderPrint({
  # For base graphics, we need to specify columns, though for ggplot2,
  # it's usually not necessary.
  res <- nearPoints(data(), input$plot_click, "speed", "dist")
  if (nrow(res) == 0)
    return()
  res
})

```

I tried to mimic the above the approach to identify the `nearPoints` in the Plotly plots using the click event data. However, it did not work.

```
output$plot <- renderPlotly({
  d <- data()
  plot(d$speed, d$dist)
})

output$plot_clickedpoints <- renderPrint({
  # For base graphics, we need to specify columns, though for ggplot2,
  # it's usually not necessary.
  res <- nearPoints(data(), event_data("plotly_click"), "speed", "dist")
  if (nrow(res) == 0)
    return()
  res
})

```

Any idea on how to pass the coordinate information to the plotly plot?