☰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

Different Hovertool for Different Data Series - Same Plot

Community Support
djgribbin11
djgribbin11

I would like to be able to have a different HoverTool for different datasets inside the same Bokeh figure. For example, the first series would have tooltips for “Date, Name” and the second series would have tooltips for “User, Typer”.

The code is am using is below. When HoverTools is called a second time it erases the tooltips from the first series. Is there a way to have different tooltips for different data series?

import numpy as np

import bokeh.plotting as bp

from bokeh.models import HoverTool, ColumnDataSource

from collections import OrderedDict

bp.output_file(‘test.html’)

fig = bp.figure(tools=“reset,hover”)

x = np.linspace(0,2*np.pi)

y1 = np.sin(x)

y2 = np.cos(x)

test = [‘test’] * len(y2)

source = ColumnDataSource(data = dict(test = test))

s1 = fig.scatter(x=x,y=y1,color=’#0000ff’,size=10,legend=‘sine’)

s1.select(dict(type=HoverTool)).tooltips = {“x”:"$x", “y”:"$y"}

s2 = fig.scatter(x=x,y=y2,color=’#ff0000’,size=10,legend=‘cosine’)

hover = s2.select(dict(type=HoverTool))

hover.tooltips = OrderedDict([(‘Test’, ‘@test’)])

bp.show(fig)

⌁   Link to post

End of archived discussion · Replies are disabled