HoverTool showing canvas coordinates not data coordinates
See original GitHub issueI don’t think this is mentioned in the other hover tool issues, but I might have missed it.
Using $x, $y
in HoverTool
displays the canvas coordinates, not the data coordinates as I believe it is supposed to. Using $sx, $sy
displays the canvas coordinates as well.
e.g.
from bokeh.plotting import figure, output_file, show
from bokeh.models import HoverTool
output_file("hover.html")
hover = HoverTool(
tooltips=[
("index", "$index"),
("data (x,y)", "($x, $y)"),
("canvas (x,y)", "($sx, $sy)")
])
TOOLS = [hover]
p = figure(plot_width=400, plot_height=400, title=None, tools=TOOLS)
p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)
show(p)
produces
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Python Bokeh - HoverTool: Coordinates for the figure and not ...
The hover tool only displays when a glyph is "hit" by the cursor. The reason for this is that field specifiers such as...
Read more >Configuring plot tools — Bokeh 2.4.3 Documentation
y-coordinate under the cursor in data space. $sx. x-coordinate under the cursor in screen (canvas) space. $sy.
Read more >Plotting with Datashader - | notebook.community
Below is a Datashader image being shown within Bokeh. This relies on the InteractiveImage function to tie the two together. You can also...
Read more >Realtime Flight Tracking with Pandas and Bokeh - Geodose
The coordinate system is not match to each other, so we can not plot the aircraft position directly on the map. The aircraft...
Read more >Display Info When You Hover To A Data Point In Matplotlib ...
This is one of the most requested topics so I thought I would finally make a video showing how to implement the feature...
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
A quick workaround: when referencing the column names using the “@” notation, the tooltips are presented correctly
@w1res there might be something specific to lines which are more complicated due to their connectivity. However, please open a new issue so this can be tracked and prioritized independently.