I created a plotly scatterplot from a ggplot2 using ggplotly
.
I would like to obtain a table of the datapoints selected / zoomed into, but I can't find a way to do this.
library(ggplot2)
library(plotly)
p <- ggplotly(plot.rel.kinship)
htmlwidgets::saveWidget(as_widget(p), "scatterplot.html")
There seems to be a similar unanswered question on the plotly forum:
https://community.plot.ly/t/get-datapoints-in-currently-zoomed-view/259
This question also seems to be related:
Using Plotly with DT via crosstalk in Shiny
Thank you for your help.
UPDATE:
library(crosstalk)
a <- datatable(king.kin.subset)
kinship.plotly.table <- bscols(widths = c(6, 4), p, a)
htmltools::save_html(kinship.plotly.table, "scatterplot_table.html")
Still cannot manage to update the DataTable based on the selection of points on the scatterplot.