importnumpyasnpfrombokeh.layoutsimportrowfrombokeh.modelsimportBoxSelectToolfrombokeh.palettesimportSpectral11frombokeh.plottingimportfigure,showN=4000x=np.random.random(size=N)*100y=np.random.random(size=N)*100radii=np.random.random(size=N)*1.5colors=np.random.choice(Spectral11,size=N)TOOLS="pan,box_select,wheel_zoom,zoom_in,zoom_out,undo,redo,reset,save"p0=figure(tools=TOOLS,active_drag="box_select",width=400,height=400,title="Box selection overlay with handles")p0.circle(x,y,radius=radii,fill_color=colors,fill_alpha=0.6,line_color=None)box_select=p0.select(BoxSelectTool)box_select.persistent=Truebox_select.overlay.hover_fill_color="yellow"box_select.overlay.use_handles=Truebox_select.overlay.handles.all.hover_fill_color="red"box_select.overlay.handles.all.hover_fill_alpha=0.7p1=figure(tools=TOOLS,active_drag="box_select",width=400,height=400,title="Box selection overlay without handles")p1.circle(x,y,radius=radii,fill_color=colors,fill_alpha=0.6,line_color=None)box_select=p1.select(BoxSelectTool)box_select.persistent=Truebox_select.overlay.hover_fill_color="green"show(row([p0,p1]))