Retain Plotly Hover on Click

I had the same question and found no way to do this in plotly.py. Though I found even better solution to the initial use case.

My use case was: copy information about certain points on the graph that I’m interested in.

I thought displaying of details in the hover and copying from hover is the best solution. Though hover has a limitation:
a) You can’t accumulate information about several points and then copy it at once
b) You need to precisely select the text to copy, which is not very convenient.

A better solution is to print information about the point on a click. Then you’ll be able to click multiple points and copy the information at once :slight_smile: And this solution is possible with plotly.py, though requires a couple additional lines of code. I’ve created a video demo (link) of how it can be done and here’s the notebook with the code (link).

The solution above even allows to convert plotly into a visual labeling tool. I’m not sure if plotly team has such a use case in mind, though it’s definitely possible, easy to add and convenient to use for labeling.

Hope it’ll help you.