6

does anyone know how to change the hover tooltips when using holoviews with a bokeh backend?

in my notebook and using holoviews for visualisation i activate tooltips using

%%opts Scatter [tools=['hover']]

by default this makes a tooltip which displays the names of the axis and the value of the point. in bokeh you can alter the tooltip using

from bokeh.models import HoverTool
hover = HoverTool(tooltips=[
    ("index", "$index")
])

or any variation of what you want the tooltip to display. when i do this first before adding the hover tool in holoview nothing changes. does anyone know how i could change this if i dont want the default, or need to format it?

sdsodi
  • 73
  • 1
  • 4

1 Answers1

8

You can pass in a tool instance to the tools plot option, e.g. declare the tool as you have then

from bokeh.models import HoverTool
hover = HoverTool(tooltips=[("index", "$index")])

Then use that hover tool in the options like this:

%%opts Scatter [tools=[hover]] (size=10)
hv.Scatter(range(10))
philippjfr
  • 3,997
  • 14
  • 15
  • thank you! just needed to not use ' ' around [hover] then. so simple. would you happen to also know the syntax for displaying the axis title in a tooltip like the stock hover tool does? – sdsodi Sep 06 '17 at 23:43