Hello everyone!
I am building a data analysis app, for viewing data collected by sensors in a formula-like vehicle during the race. I would like to do a line plot (of a sensor reading) and a scatter plot of the logged gps positions during the lap, which is the easy part and I have done it.
However I am struggling on the following: When hovering my mouse over the line plot, I would like the corresponding scatter plot point to change color, because it is easier for me to understand which track section the vehicle is at.
A sample code that represents what have I done is the following:
from bokeh.layouts import gridplot
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, show
source = ColumnDataSource(data=dict(x=[1, 2, 3, 4, 5], y1=[1, 2, 3, 4, 5], y2=[1, 4, 9, 16, 25]))
TOOLS = "box_select,hover,reset"
p1 = figure(height=300, width=300, tools=TOOLS)
p1.line(x="x", y="y1", hover_color="red", source=source)
p2 = figure(height=300, width=300, tools=TOOLS)
p2.scatter(x="x", y="y2", size=10, hover_color="red", source=source)
show(gridplot([[p1, p2]]))
As you can see I have set hover_color
parameter on both line and scatter plot, but when I hover my mouser over the line plot, the whole line becomes red and so do all the scatter glyphs. If i change my line plot to scatter the code works as expected, however it is not easy to read time series data using scatter plot.
Maximum length of input data table is 100,000 rows, so a delicate solution (maybe involving javascript ) would be highly appreciated!
Thanks in advance