I created a scatterplot which will be linked to a datatable for filtering purposes. When someone drags with the mouse, the plot zooms in. I’d like to know which points are in the zoomed view, so that I can give them the appropriate colour and communicate the selection to the datatable. I looked at the ‘plotly_relayout’ event, but the eventdata seems to contain only information about the axis.
Is there an easy way to find which points are in the current view?
There is currently no easy way to do this at the moment.
You could use the
plotly_relayout event to get the current axis ranges and write a routine that filters for data inside that range.
That said, we are currently working on adding a brushing feature to plotly.js. This feature should be adding by the end of January 2016.
Great! Looking forward to the feature.
By the way, are you also planning on adding support for other events? It would be really useful if we could e.g. customise how double-click is handled (e.g. zoom and call some other function).
No formal short-term plans, but both would nice additions. Thanks for the suggestions.
@adridder lasso and rectangular selections are now available in plotly.js v1.4.0 http://codepen.io/etpinard/pen/OMgWjz
Thanks! Using the new version now. Ran into some issues; I’ll create a bug report on github.
Is there a way to do this in plotly in R yet?
I am hoping to take the zoomed in points of a scatter plot and display them in a datatable and for the datatable to adjust to the zoom. I am using Shiny and I can get it to work for plotly_click
Lasso is a really interesting tool to get the data but I would like to know about the initial question, is it possible to get the data points (or data index is fine too) of the displayed data (for example, after zoom or relayout)
You mean all visible data points after zoom / pan?
Yes exactly. Is there an easy way to get these points ? I can get them using the layout range but it does not look a very efficient way to do.
the plotly.js hover events don’t send this information at the moment.
Ok thank you, I was still able to get my points using the layout range so it is fine
@oro77 yeah, sorry about that. You’re not the first user asking for such feature.
We’ll consider it in https://github.com/plotly/plotly.js/issues/145
I think I have a similar question in that I would like to select datapoint on the scatter plot for filtering purposes. I have created the scatter plot as https://plot.ly/r/shinyapp-plotly-events/
and using lasso or box, I get those datapoint I want to exclude return on screen. I am just wondering if there is a way to save the return point into R directly as a vector for downstream processing. At the moment, I need to cut and paste those return value into a text file… I guess there must be a better wat to do so. Many thanks for your help.
It’s been a while since the last post on this thread, but I need to do the same thing that is being asked here by the OP. Has this feature been integrated yet?
Note: Posted a question about this on StackOverflow:
Is there any way I can get data points info when I zoom into 3-D Scatter plots .
Like when I zoom in , if I can get handle of some object which can help know how many data points are present in current view/scene .
Hi Community !
Has this issue been solved ?
I’m also looking for a way to get visible datapoints in zoomed view. It seems odd that
selectedData provides both points and range while
relayoutData only returns the latter.
The linked issue on Github ( #145) seems to be waiting for sponsorship.
Any new leads from anyone ?