I have multiple figures with a merged toolbar. I would like to use the
PointDrawTool in a way such that it does only adds or edits a point on the figure the mouse is currently on and not on both figures. Here is a example with a couple figures.
import numpy as np from bokeh.io import curdoc from bokeh.layouts import gridplot from bokeh.models import ColumnDataSource from bokeh.plotting import figure N = 200 x = np.linspace(0, 4*np.pi, N) y = np.sin(x) z = np.cos(x) source = ColumnDataSource(data=dict(x=x, y=y, z=z)) plot1 = figure(plot_height=400, plot_width=400, title="my sine wave", tools="crosshair,pan,reset,save,wheel_zoom", x_range=[0, 4*np.pi], y_range=[-2.5, 2.5]) circle1 = plot1.circle('x', 'y', source=source) plot2 = figure(plot_height=400, plot_width=400, title="my cosine wave", tools="crosshair,pan,reset,save,wheel_zoom", x_range=[0, 4*np.pi], y_range=[-2.5, 2.5]) circle2 = plot2.circle('x', 'z', source=source) pdt = PointDrawTool(renderers=[circle1, circle2]) plot1.add_tools(pdt) grid = gridplot([[plot1], [plot2]], toolbar_location='above') grid.children.sizing_mode = 'fixed' grid.children.height = 1000 grid.children.width = 500 curdoc().add_root(grid) curdoc().title = "Point Draw Test"
I have tried various combinations of adding the
PointDrawTool to just one or both figures or adding unique PointDrawTools or changing which renderers I add to each tool. Each method seems to work about the same way although sometimes there will be duplicate tools added to the toolbar.
I would prefer to just add one tool to the toolbar and have the
PointDrawTool only affect point on the applicable figure but I would also accept if there is a way to have a merged toolbar above the figures with separate individual toolbars on the left of each figure for housing the
PointDrawTool. Not sure if this last one is possible. Thoughts? Thank you!