Select data points for a specific trace from a multi trace plot

So I have a multitrace plot say, it has 3 traces. Now I want to select data points for a region only for 1st trace. Now the problem is when I select the region it also select datapoints from 2nd and 3rd trace, if there are data points for those traces in the selected region. But I want to select points only for 1st trace , how do I do that?

1 Like

We don’t allow that at the moment. It would be a cool feature though.

Sorry to hear that, it really could have helped me in my project. In the mean time I have to implement my own function to filter out the points for other traces.

Its not offered natively by plotly yet, but one way of achieving this would be explicitly setting the ‘selectedpoints’ to empty array and then restyling the trace.

gd.on('plotly_selected', () => {
    // replace tn with trace number of plot from which you do not want to select points[tn].selectedpoints = []

    // send appropriate arguments for the restyle function below

After I posted the question plotly had added an object curveNumber to the plotly_selected event data, from there we can easily get the trace information.