I have the following plot
using
from bokeh.layouts import gridplot
from bokeh.models import ColumnDataSource, CDSView, IndexFilter
from bokeh.plotting import figure, show
from bokeh.io import curdoc, output_notebook, output_file, export_png
from bokeh.models import (
ColumnDataSource, Circle, Square, HoverTool,Grid, TapTool,PanTool, WheelZoomTool, BoxSelectTool,ZoomInTool, ZoomOutTool, CDSView, GroupFilter)
curdoc().clear()
output_notebook()
source1 = ColumnDataSource(data=dict(x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 5]))
source2 = ColumnDataSource(data=dict(x=[3, 4], y=[2, 3]))
p = figure(plot_height=300, plot_width=300, tools="pan,wheel_zoom,box_zoom,reset,zoom_in,zoom_out,save")
circle = Circle(x="x", y="y", size=10)
square = Square(x="x", y="y", size=10)
hover_square = Square(x="x", y="y", size=10, fill_color="red")
c = p.add_glyph(source1, circle)
s = p.add_glyph(source2, square, hover_glyph=hover_square)
c_hover = HoverTool(renderers=[c,s], tooltips=[('x', '@x')])
p.add_tools(c_hover)
show(p)
I want to change the color of bottom three circles when I hover on the bottom square and top 2 circles when top square is hovered on? Let's say I have a dataframe which identifies this relationship.
Is there a way to do this in Bokeh?
It would be even better if I can also show lines from a square to circles depicting the relationship only when a I hover on a square.