Hi everyone, I am encountering some strange issues related to the BoxEdit. I use the following code to test the BoxEdit feature
import skimage
import numpy as np
import holoviews as hv
from holoviews import opts
from holoviews import streams
hv.extension('bokeh')
data = skimage.data.brain()
ds = hv.Dataset(
(np.arange(256), np.arange(256), np.arange(10), data),
["x", "y", "num"],
"count",
)
polys = hv.Polygons([])
box_stream = streams.BoxEdit(source=polys)
def stats(data):
if not data or not any(len(d) for d in data.values()):
return hv.Text(128, 128, "N/A")
x0, x1, y0, y1 = data['x0'], data['x1'], data['y0'], data['y1']
return hv.Text(128, 128, f"x0={x0}\nx1={x1}\ny0={y0}\ny1={y1}")
dmap = hv.DynamicMap(stats, streams=[box_stream])
im = ds.to(hv.Image, ['x', 'y'], dynamic=True)
(im * polys + dmap).opts(
opts.Curve(width=400, framewise=True),
opts.Polygons(fill_alpha=0.2, line_color='red'),
opts.VLine(color='black')
)
I can use double click to add a new box select, and drag it around with single click and hold. However, I cannot delete any added box as the delete or backspace key do nothing. Am I missing something critical here that is preventing me from delete existing boxes?