☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

HoverTool hit detection fails on vertical and near-vertical segment glyphs

Community Support
Matt_Blanchard
Matt_Blanchard

Maybe I’m doing something wrong, but the HoverTool does not appear to work for segment glyphs that have vertical orientation.

from bokeh.plotting import figure

from bokeh.models import HoverTool

hover = HoverTool(tooltips=[

("index", "$index"),

("(x,y)", "($x, $y)")

])

p = figure(title=“Background Analysis”,

       toolbar_location="above",

       tools=[hover],

       plot_width=400, 

       plot_height=400)

p.segment(

x0=[1, 2, 3], 

x1=[1, 2.4, 3.1],

y0=[1, 2, 3], 

y1=[2, 2.5, 3.7], 

)

show(p)

I opened an issue on github, but maybe there’s a workaround or I’m doing something wrong?

Thanks,

Matt

⌁   Link to post
Bryan
Bryan

Looking at the implementation:

  https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/glyphs/segment.coffee

I don't see anything offhand. But it's possible that:

* the third party spatial index we use (RBush) has a problem with vertical segments
* hittest.dist_to_segment has some obscure bug
* something else

It will require some investigation. If you have the ability to poke at it, I am happy to provide some debugging guidance. Otherwise it's probably not something that will be able to get a look until after the next release.

Some ideas for questions to answer that would provide additional useful information:

* does using tall, narrow quad/rect/vbar work?

* do vertical line or multilines work?

Answers to these questions could help narrow down where the problem actually is, and possibly provide a workaround in the immediate term.

Thanks,

Bryan

···

On Aug 8, 2017, at 14:43, Matt Blanchard <matt.blanchard@gmail.com> wrote:

Maybe I'm doing something wrong, but the HoverTool does not appear to work for segment glyphs that have vertical orientation.

from bokeh.plotting import figure
from bokeh.models import HoverTool

hover = HoverTool(tooltips=[
    ("index", "$index"),
    ("(x,y)", "($x, $y)")
])

p = figure(title="Background Analysis",
           toolbar_location="above",
           tools=[hover],
           plot_width=400,
           plot_height=400)

p.segment(
    x0=[1, 2, 3],
    x1=[1, 2.4, 3.1],
    y0=[1, 2, 3],
    y1=[2, 2.5, 3.7],
)

show(p)

I opened an issue on github, but maybe there's a workaround or I'm doing something wrong?

Thanks,
Matt

--
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/00df489f-936b-4579-81dc-9d72e7b0000a%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled