PolyDraw tool not appearing in toolbar

Why doesn’t the PolyDraw tool appear in the toolbar:

Screen Shot 2021-11-04 at 4.23.40 PM

Usually that’s automatic, e.g. Polydraw — HoloViews 1.14.5 documentation works even without the active_tools bit. I can’t cut and paste your code above since it’s an image, but you could try adding .opts(tools=['poly_draw']). Next time please include runnable code in your post!

Adding the “.opts” call to the DynamicMap makes the tool appear on the toolbar, but it doesn’t work- double clicking in the image with the tool activated doesn’t create a polygon node. The same code executed statically (without the DynamicMap) works as expected. Here is the code for both:


import holoviews as hv
from holoviews import opts, streams


poly = hv.Polygons([])
poly_stream = streams.PolyDraw( source=poly, show_vertices=True, styles=dict(fill_alpha=1.0,fill_color="blue"))

def dmap_poly( **kwargs ):
    print( f"dmap keys: {kwargs.keys()}")
    return poly
hv.DynamicMap( dmap_poly, streams=[ poly_stream ] ).opts(tools=['poly_draw'])


poly1 = hv.Polygons([])
poly_stream1 = streams.PolyDraw( source=poly1, show_vertices=True, styles=dict(fill_alpha=1.0,fill_color="blue"))


Thanks for the reproducible example! Yes, it’s automatic when directly displaying the Polygons, but using the DynamicMap seems like you’ll need to connect that tool to the stream somehow. @jstevens or @philippjfr ?