Hovertool that only applies to certain glyphs?

I’m trying to add a hover tool to a plot. The hover tool would only apply to certain lines on the plot but not others.

The examples in the documentation have the hovertool added to the entire figure. It’s not clear to me that I can associate a hover tool with only certain lines and not others.

Is it possible to create a hover tool and have it only appear over certain parts of the plot and not all of it? (The property that the hovertool references will not exist for the other lines on the plot.)

You can restrict a hover tool to certain glyphs by explicitly configuring HoverTool.renderers. There are several examples in the repo, here is one:

bokeh/hover.py at branch-2.4 · bokeh/bokeh · GitHub

The second question is not so clear. It is not possible to restrict the hover tool based on region or area (e.g. “only the left side of the plot”) if that is what you mean.

1 Like

Perfect! Thanks!
By certain parts of the plot, I just meant by glyph, not by coordinates. I just want to put a hovertool on lines with property_x and not lines without property_x and not my scatter glyphs.

1 Like