Implementing Sticky Hover Tool in Bokeh


I would like to restart a discussion about the possibility of making a sticky hover tool in Bokeh. After researching and reading through previous discussions in the forums, it seems that the implementation of the InfoPane object would have addressed this need (, but unfortunately, it was never completed.

Currently, it appears that there are complex workarounds to achieve this functionality [ Feature Request: HoverTool tooltips stick to a point on click. · Issue #5724 · bokeh/bokeh · GitHub, Feature Request: HoverTool tooltips stick to a point on click. · Issue #5724 · bokeh/bokeh · GitHub]. However, I am curious if there are any new ideas or updates on the development of a sticky hover tool in Bokeh.

When multiple data points overlap and we use the tap tool to open a new window, only the window of the top data point opens. The rest of the data points are inaccessible. With a sticky hover tool, the user can click on a stack of data points, and the tooltip will remain visible. This enables the user to select which data point’s window to open.

I would appreciate any insights or suggestions on implementing a sticky hover tool in Bokeh.

The underlying technical work for a persistent tooltip has already been done, in this PR:

Which was added for 3.0 awhile back.

These Tooltip objects can be attached to just about anything, but the specific use-case of adding them to plots is not yet very well demonstrated. Additionally there are probably some conveniences that are missing to make this specific use-case simpler. [1] The motivation at the time was for adding them to widgets, etc, so that is where the examples and docs were focused. Improving things for this use-case and adding examples/docs to support it would be a welcome contribution. I’d encourage starting a GitHub development discussion about this, so it’s easier to loop in relevant core devs.

cc @mateusz

  1. Right now I think you’d have to manually compute a data-screen coordinate transform in a tap tool callback (or whatever) in order to add the tooltip relative to a data coordinate, and if your plot can be pan/zoomed, you’d probably need to manually update that screen position in a range callback. ↩︎

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.