Reputation: 1644
My basic TOOLTIPS for the BoxPlot code
TOOLTIPS = """
<div style="background-color:orange;">
<div>
<span style="font-size: 15px; color: #966;">@name</span>
</div>
<div>
<span style="font-size: 10px; color: black;">($y{int})</span>
</div>
</div>
"""
When i Hover over the BoxPlot whiskers - i get multiple data points displayed . Am not even sure if this is acceptable behaviour for Bokeh , i am presuming its a coding error on my part.
p = figure(tools="", background_fill_color="#efefef", x_range=cats,plot_width=195, plot_height=550,tooltips=TOOLTIPS)
Code for whiskers taken from the Official Bokeh example :-
# whiskers (almost-0 height rects simpler than segments)
p.rect(cats, lower.height, 0.2, 0.01, line_color="black")
My plot with multiple data points displayed as seen below - am not aware where to look for the Bug / Own Coding error. Kindly note the Hover tool [PLUS Shaped Cursor] is not visible in the screen-capture , while taking the screen-capture it was over the "Lower" Data Point , of the two displayed.
Upvotes: 1
Views: 1166
Reputation: 8287
As far as I can see in the code you define a tooltip
on figure
level so having multiple glyphs in there (2 segments, 2 vbar's, 2 rect's, 1 circle) can cause multiple tooltips being displayed.
I suggest you create a HoverTool and explicitly specify the renderers for it like this:
from bokeh.models import HoverTool
p = figure(tools="", background_fill_color="#efefef", x_range=cats,plot_width=195, plot_height=550)
b1 = p.vbar(cats, 0.7, q2.height, q3.height, fill_color="#E08E79", line_color="black")
b2 = p.vbar(cats, 0.7, q1.height, q2.height, fill_color="#3B8686", line_color="black")
hover = HoverTool(tooltips = TOOLTIPS, renderers = [b1, b2])
p.add_tools(hover)
Upvotes: 3