I have this code here which creates a bokeh plot where all plots pan and zoom together. I want to be able to hide the same named line, 'line1', simultaneously on all 3 plots when I click the line1 legend item (or an optional additional widget or checkbox outside the plots) instead of having to click them individually. How do I do that?
Line 1 could be created from a different data source every time, ie the x values for all the lines are the same but the y values could be different between (plot 0, line1) and (plot 1, line1)
Current Output:
Wanted Output:
from bokeh.io import output_file, show,save
from bokeh.layouts import column
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource
output_file("panning.html")
data=[]
x = list(range(11))
y0 = x
y1 = [10-xx for xx in x]
y2 = [abs(xx-5) for xx in x]
source = ColumnDataSource(data=dict(x=x, y0=y0, y1=y1,y2=y2))
for i in range(3):
p = figure(title="Basic Title", plot_width=300, plot_height=300)
if len(data):
p.x_range=data[0].x_range
p.y_range=data[0].y_range
p.circle('x', 'y0', size=10, color="navy", alpha=0.5,legend_label='line1', source=source)
p.triangle('x', 'y1', size=10, color="firebrick", alpha=0.5,legend_label='line2', source=source)
p.square('x', 'y2', size=10, color="olive", alpha=0.5,legend_label='line3', source=source)
p.legend.location='top_right'
p.legend.click_policy = "hide"
data.append(p)
plot_col=column(data)
# show the results
show(plot_col)
save(plot_col)

