Hover Tool bugged using different classes in bokeh 0.12.15

Hello everyone.

So, I am using bokeh since several months now for a project of mine and with the newest version, I have problems using the Hover-Tool, when I have several classes in my plot/legend.

Whenever I am hiding the first class from the plot, the Hover Tool does not work for the rest of my classes.

I am attaching two pictures, as this is the easiest way to explain my problem… please note that you cannot see the mouse in the screenshots, but believe, I put the mouse cursor

over my glyph in both screenshots :wink:

I used an older version of bokeh (not really sure whether it was 0.12.13 or 0.12.14, I am very sorry…), where I had no troubles with this Hover-Hiding-Interaction.

I searched roughly through the github issues and this google group, but to my knowledge, this wasn’t reported yet. If it was, please take my apologies for making this duplicate.

Cheers,

Kevin

Hi,

I'm not aware of an intentional changes. So a change could be a bug/regression, but it could also be that the previous behavior was undefined and unintentional in the first place. It's not really possible to say much else without code to run. The most helpful thing would be to provide a complete, runnable, minimal example that reproduces the issue.

Thanks,

Bryan

···

On Apr 16, 2018, at 09:42, [email protected] wrote:

Hello everyone.

So, I am using bokeh since several months now for a project of mine and with the newest version, I have problems using the Hover-Tool, when I have several classes in my plot/legend.
Whenever I am hiding the first class from the plot, the Hover Tool does not work for the rest of my classes.

I am attaching two pictures, as this is the easiest way to explain my problem... please note that you cannot see the mouse in the screenshots, but believe, I put the mouse cursor
over my glyph in both screenshots :wink:

I used an older version of bokeh (not really sure whether it was 0.12.13 or 0.12.14, I am very sorry...), where I had no troubles with this Hover-Hiding-Interaction.
I searched roughly through the github issues and this google group, but to my knowledge, this wasn't reported yet. If it was, please take my apologies for making this duplicate.

Cheers,
Kevin

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/17ce085e-4d63-4d06-9002-ad486d3288ea%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
<hover_hide_2.png><hover_hide_1.png>

I will try to put something together that reproduces the issue. Thanks for the quick answer.

···

Am Montag, 16. April 2018 18:48:18 UTC+2 schrieb Bryan Van de ven:

Hi,

I’m not aware of an intentional changes. So a change could be a bug/regression, but it could also be that the previous behavior was undefined and unintentional in the first place. It’s not really possible to say much else without code to run. The most helpful thing would be to provide a complete, runnable, minimal example that reproduces the issue.

Thanks,

Bryan

On Apr 16, 2018, at 09:42, [email protected] wrote:

Hello everyone.

So, I am using bokeh since several months now for a project of mine and with the newest version, I have problems using the Hover-Tool, when I have several classes in my plot/legend.

Whenever I am hiding the first class from the plot, the Hover Tool does not work for the rest of my classes.

I am attaching two pictures, as this is the easiest way to explain my problem… please note that you cannot see the mouse in the screenshots, but believe, I put the mouse cursor

over my glyph in both screenshots :wink:

I used an older version of bokeh (not really sure whether it was 0.12.13 or 0.12.14, I am very sorry…), where I had no troubles with this Hover-Hiding-Interaction.

I searched roughly through the github issues and this google group, but to my knowledge, this wasn’t reported yet. If it was, please take my apologies for making this duplicate.

Cheers,

Kevin


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/17ce085e-4d63-4d06-9002-ad486d3288ea%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

<hover_hide_2.png><hover_hide_1.png>

Well, here you go. I tried to make it as minimal as I could.

Hoping that Google groups support code formatting, I will copy&paste it here. If it doesn’t work, please find the .py file in this answer as well.


#!/usr/bin/env python3

from bokeh.plotting import figure, ColumnDataSource

from bokeh.models import HoverTool

from bokeh.models.tools import ResetTool, BoxZoomTool, WheelZoomTool, PanTool, SaveTool

from bokeh.io import saving

import pandas as pd

import random

colors = {0: '#b3ac00', 1: '#0eb300', 2: '#00b39d', 3: '#0011b3', 4: '#9a00b3'}

data = []

for i in range(5):

sub_sample = [(random.randint(0, 100), random.randint(0, 100), colors[i], i)

for _ in range(10)]

data.extend(sub_sample)

hover = HoverTool(tooltips=[("Position", "@x{0,0} - @y{0,0}")])

dotplot = figure(plot_width=600, plot_height=600,

x_range=(0, 120),

y_range=(120, 0),

# y_range=(0,len(ref_sequence)),

x_axis_label="Genomic coordinate",

y_axis_label="Genomic coordinate",

x_axis_location="above",

tools=[hover, ResetTool(), BoxZoomTool(),

WheelZoomTool(), PanTool(), SaveTool()],

toolbar_location="below")

for idx, color in colors.items():

sub_data = pd.DataFrame([x for x in data if x[-1] == idx], columns=['x', 'y', 'color', 'idx'])

source = ColumnDataSource(data=dict(

x=sub_data.x,

y=sub_data.y,

color=sub_data.color))

renderer = dotplot.square('x', 'y', fill_color="color", fill_alpha=0.8,

muted_color="color", muted_alpha=0,

line_color="black", line_alpha=1,

source=source, size=8,

legend="{} sub sample".format(idx))

renderer.visible = False

dotplot.x_range.bounds = (-10, 120)

dotplot.y_range.bounds = (-10, 120)

dotplot.legend.location = "top_right"

dotplot.legend.click_policy = "hide"

saving.save(dotplot, filename="mini-ex_hover.html", title="Hover-Legend-Interaction")

minimal_example.py (1.89 KB)

···

Am Montag, 16. April 2018 18:48:18 UTC+2 schrieb Bryan Van de ven:

Hi,

I’m not aware of an intentional changes. So a change could be a bug/regression, but it could also be that the previous behavior was undefined and unintentional in the first place. It’s not really possible to say much else without code to run. The most helpful thing would be to provide a complete, runnable, minimal example that reproduces the issue.

Thanks,

Bryan

On Apr 16, 2018, at 09:42, [email protected] wrote:

Hello everyone.

So, I am using bokeh since several months now for a project of mine and with the newest version, I have problems using the Hover-Tool, when I have several classes in my plot/legend.

Whenever I am hiding the first class from the plot, the Hover Tool does not work for the rest of my classes.

I am attaching two pictures, as this is the easiest way to explain my problem… please note that you cannot see the mouse in the screenshots, but believe, I put the mouse cursor

over my glyph in both screenshots :wink:

I used an older version of bokeh (not really sure whether it was 0.12.13 or 0.12.14, I am very sorry…), where I had no troubles with this Hover-Hiding-Interaction.

I searched roughly through the github issues and this google group, but to my knowledge, this wasn’t reported yet. If it was, please take my apologies for making this duplicate.

Cheers,

Kevin


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/17ce085e-4d63-4d06-9002-ad486d3288ea%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

<hover_hide_2.png><hover_hide_1.png>

Hi,

I have the same problem on bokeh 0.12.15, here is maybe a more minimalist example:


from bokeh.models import HoverTool, ColumnDataSource

from bokeh.io import show

from bokeh.plotting import figure

plot=figure()

s1=ColumnDataSource(dict({'x1':[i for i in range(0,20)],'y1':[i for i in range(0,20)]}))

s2=ColumnDataSource(dict({'x1':[i for i in range(0,20)],'y1':[20-i for i in range(0,20)]}))

plot.square(x='x1',y='y1',source=s1,legend='1')

plot.square(x='x1',y='y1',source=s2,legend='2')

plot.legend.click_policy="hide"

hover=HoverTool(tooltips=[('x','@x1'),('y','@y1')])

plot.add_tools(hover)

show(plot)

The HoverTool is not visible when the first glyph is hidden and there is the following error in the console:

Uncaught TypeError: Cannot read property ‘is_empty’ of null

Thanks

Louis

Hey there again,

I just updated bokeh to the latest 0.12.16 release and everything works as it used to, before 0.12.15. So I hope this behavior is intended in the first place and does not get changed soon :wink:

Thanks!

···

Le mardi 15 mai 2018 08:37:25 UTC+2, Kevin Lamkiewicz a écrit :

Hey there again,

I just updated bokeh to the latest 0.12.16 release and everything works as it used to, before 0.12.15. So I hope this behavior is intended in the first place and does not get changed soon :wink: