Return something as a click event

Hey everyone,
I am wondering whether it is possible to get the x and y values of my mouse click on a graph. Basically something like a MATLAB or matplotlib’s ginput function. I have searched extensively online but didn’t really find a solution.

The closest thing I have found is the scatter.on_click() function. This function takes a callback function but it returns nothing. I have seen the official example using it with the “click event” as an update to the figure (i.e. change symbol colors and size for the clicked-on points).

Is it possible to define a new callback function that would return the value as something that I can then work with? I have managed to change the callback function in the official example to :slight_smile:def return_point(trace, points, selector): xt=points.xs print(xt)
but still I can only print but not store these x values.

Really appreciate your help!

I’m currently searching the solution for this too. have you got the solution?