☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Update one figure based on hover over another figure

Community Supporthover
scott-trinkle
scott-trinkle

I have data formatted similar to this example:

import numpy as np
import pandas as pd

x, y = np.meshgrid(np.arange(3), np.arange(3))
z1 = x + y + 1
z2 = x + y + 2
z3 = x + y + 3

data = {'x': x.flatten(),
        'y': y.flatten(),
        'z1': z1.flatten(),
        'z2': z2.flatten(),
        'z3': z3.flatten()
        }
df = pd.DataFrame(data)

x and y correspond to spatial locations, and z1-z3 correspond to different variables at those locations.

I would like to have two linked figures. One figure shows an image of one of the variables (say z1, for example). The second figure should be linked such that when the mouse hovers over a pixel in the z1 figure, the linked figure shows a line plot of all variable values (z1,z2, and z3) corresponding to hovered xy pixel.

Is this possible with bokeh? It seems like figure 1 (the image) would need to pass the xy hover info back to python in order to tell figure 2 (the line plot) which values to plot.

⌁   Link to post
Bryan
Bryan

Programmatic control over tooltips is still an open issue so there is not any way to achieve this directly. The possible workaround for now would be to use hover events to hide/show labels or text glyphs on the other plot, however, labels and text glyphs don’t support all the rich formatting that hover tooltips do.

⌁   Link to post

End of archived discussion · Replies are disabled