Skip to content Skip to sidebar Skip to footer

Bokeh Hover Tooltip Not Displaying All Data - Ipython Notebook

I am experimenting with Bokeh and mixing pieces of code. I created the graph below from a Pandas DataFrame, which displays the graph correctly with all the tool elements I want. Ho

Solution 1:

Try using ColumnDataSource.

Hover tool needs to have access to the data source so that it can display info. @x, @y are the x-y values in data unit. (@ prefix is special, can only followed by a limited set of variable, @y2 is not one of them)., Normally I would use $+ column_name to display the value of my interest, such as $weight. See here for more info.

Besides, I am surprised that the hover would appear at all. As I thought hoverTool doesn't work with line glyph, as noted here

Try the following : (I haven't tested, might have typos).

df = yearly_DF.reset_index() # move index to column.source = ColumnDataSource(ColumnDataSource.from_df(df)

hover.tooltips = OrderedDict([('x', '@x'),('y', '@y'), ('year', '$index'), ('weight','$weight'), ('muscle_weight','$muscle_weight'), ('body_fat','$bodyfat_p')])

p.line(x='index', y='weight', source=source, legend="Weight")
p.line(x='index', y='muscle_weight', source=source, legend="Muscle Mass", line_color="red")

Solution 2:

Are you using Firefox? This was a reported issue with some older versions of FF:

https://github.com/bokeh/bokeh/issues/1981

https://github.com/bokeh/bokeh/issues/2122

Upgrading FF resolved the issue.

Post a Comment for "Bokeh Hover Tooltip Not Displaying All Data - Ipython Notebook"