I have a large heatmap in which I plot the cells via p.image
with a hover that shows the exact values.
Additionally, when hovering over a region the region should be highlighted with an outline. A p.rect
with only hover_outline_alpha=1
works exactly as I want it, but additionally it shows a hover tooltip. Is there any way to disable the hover tooltip while still having the visual changes triggered?
from bokeh.palettes import Viridis256
from bokeh.models import HoverTool
from bokeh.plotting import figure
image = [np.array([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]])]
p = figure(x_range=["aa", "ab", "ba", "bb"], y_range=["aa", "ab", "ba", "bb"],
tooltips=[("x", "$x"), ("y", "$y"), ("value", "@image")])
# heatmap
image_renderer = p.image(image=image, x=0, y=0, dw=4, dh=4, palette=Viridis256)
# outlines for each region
rect_renderer = p.rect(x=[1, 1, 3, 3], y=[1, 3, 1, 3], width=2, height=2,
fill_alpha=0.0, line_alpha=0.0, hover_line_alpha=1, line_width=3)
# Disables the tooltip on rect_renderer, but also does not trigger the outline
p.hover.renderers = [image_renderer]
# Seperate hover triggers the hover, but also shows an empty tooltip.
p.add_tools(HoverTool(renderers=[rect_renderer], tooltips=""))
show(p)
question from:
https://stackoverflow.com/questions/66061585/how-to-trigger-visual-effects-of-hover-without-showing-a-hover-tooltip