I’m trying to replicate the hovertool with image intensity (and mask intensity from an external mask).
How do I do this? So far I have:
MyHover1 = HoverTool(
tooltips=[
( ‘(x, y)’, ‘($x, $y)’),
(‘Intensity’, ‘$Intensity’),
],
formatters={
‘(x, y)’ : ‘numeral’,
‘Intensity’: ‘numeral’,
},
point_policy=“follow_mouse”
)
def image_slice(dims, array, lbrt, mapper, smooth_fun):
array = np.asarray(array)
low = mapper[‘low’] if mapper else array.min()
high = mapper[‘high’] if mapper else array.max()
cmap = mapper[‘palette’] if mapper else ‘fire’
img = hv.Image(smooth_fun(array), bounds=lbrt, kdims=dims, vdims=‘Intensity’).opts(tools=[MyHover1])
reset_fun = partial(hook_reset_range, lbrt=lbrt)
return img.opts(clim=(low, high), cmap=cmap, hooks=[reset_fun])