[BUG] HoverTool in 'vline' mode doesn't work with vertical segments
See original GitHub issueBokeh version: 1.4 Python version: 3.7.5 Browser: Firefox / Chromium OS: Linux
When adding a HoverTool
with mode='vline'
to a plot with vertical segments, the tooltip is not displayed.
Example code:
from bokeh.io import output_file, save
from bokeh.models import HoverTool
from bokeh.plotting import figure
x = [1, 2, 3, 4]
y0 = [1] * 4
y1 = [2] * 4
fig = figure(tools=[HoverTool(mode='vline')])
fig.segment(x, y0, x, y1)
output_file('vline.html')
save(fig)
Screenshot:
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (17 by maintainers)
Top Results From Across the Web
HoverTool hit detection fails on vertical and near-vertical segment ...
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 ......
Read more >Bokeh: Display only a single tooltip - python - Stack Overflow
from bokeh.models import (HoverTool, ColumnDataSource, Title, ... hover = HoverTool() hover.mode = 'vline' # activate hover by vertical line ...
Read more >Bokeh 2.4.2 - FreshFOSS
Tasks: - #9458 component: bokehjs hovertool in 'vline' mode doesn't work with vertical segments. - #9581 Update dockertools.
Read more >bokeh Changelog - pyup.io
12578 [component: bokehjs] [BUG] gridplot reset button does not reset all figures ... [bug] hovertool in 'vline' mode doesn't work with vertical segments...
Read more >Source code for netpyne.analysis.interactive
... from bokeh.palettes import Viridis256 from bokeh.models import HoverTool ... and plot vertical lines for each spike to evidence synchrony if ``True``.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK well let’s make a PR and go from there (the other reason to make a PR earlier is that it is much easier for other people to try out a PR)
@kumaran-14 the span coordinate geometry comes in as pixel coordinates. You can see that scale
invert
function is use to convert to back to “data space” (so that the spatial index an be used to get a first batch of potential hits). Scales also have acompute
method, which goes in the opposite direction, converting from data space to pixel space. You can use that to convert segment data coordinates to pixel coordinates in a similar way, for the final comparison.