I have a figure with some glyphs, but only want tooltips to display for certain glyphs. Is there currently a way to accomplish this in Bokeh?
Alternatively, is there a way to plot two figures on top of each other? It seems like that would let me accomplish what I want to do.
You need to name your glyph with the
name=
attribute on the glyph that you are interested in having the hover tool active for and then set that name in the hover tool'snames=
attribute. (Note thename=
attribute of thefig.line
glyph in the example below.Will Zhang's answer will work, but you would end up with multiple hover tools. If this is undesirable, you can add renderers to an existing hover tool:
So the differences here:
plotting
interface and this will still work.Thanks to this page in Google Groups I figured out how this can be done. Link here
Edit 2015-10-20: looks like the google group link doesn't work anymore unfortunately. It was a message from Sarah Bird @bokehplot.
Edit 2017-01-18: Currently this would add multiple hover tool icons to the tool bar. This may cause problems. There is already an issue filed at github here. Alternatively, try @tterry's solution in the answer below.
Essentially you need to (bokeh version 0.9.2):
hover
in yourtools
when you create the figureExample:
Also if you need to add legend to each of the glyphs you are adding, try using
bokeh.plotting_helpers._update_legend()
method. github source Eg:Hover is not currently supported for image type glyphs and line glyphs. So, using one of these glyphs in combination with glyphs that support hover tool tip, might be a work around.
See: http://bokeh.pydata.org/en/latest/docs/user_guide/objects.html#hovertool