Cursor plot label

Hi everyone! I plotted a figure composed by 3 subplots. In each subplots there are multiple lines containing different kind of data.
What I’d like to obtain is having a cursor’s label containing:
data1: y_data1
data2: y_data2
data3: y_data3
data3: y_data3
data3: y_data3
The subplots are aligned so they have the same x axis even if they are moved.

The code in question is the following:

from pandas import read_csv
import warnings
warnings.simplefilter(action=‘ignore’, category=RuntimeWarning)
from bokeh.models import HoverTool
from bokeh.layouts import column
from bokeh.io import curdoc
from bokeh.plotting import figure, output_file, show
series = read_csv(
‘C:\Users\Folder’ + str(10) + ‘.txt’,
sep=",", header=0)
L=len(series)
x=list(range(L))
output_file(“dark_minimal.html”)
curdoc().theme = ‘dark_minimal’
p1 = figure(title=“Football”, x_axis_label=“Time [0.1s]”, y_axis_label=“Matches”, width=1800, height=300)

add a line renderer with legend and line thickness

p1.line(x,series[“GustavoA”], legend_label=“GustavoA”, line_width=2, color=“orange”)
p1.line(x,series[“JohnA”], legend_label=“JohnA”, line_width=2, color=“cyan”)
p1.line(x,series[“JeoffA”], legend_label=“JeoffA”, line_width=2, color=“yellow”)
p1.add_tools(HoverTool(tooltips=[(“MatchesA”,"@y")],mode = “vline”))
p2 = figure(title=“Baseball”, x_axis_label=“Time [0.1s]”, y_axis_label=“Matches”, width=1800, height=300, x_range=p1.x_range)

add a line renderer with legend and line thickness

p2.line(x,series[“GustavoB”], legend_label=“GustavoB”, line_width=2, color=“cyan”)
p2.line(x,series[“JohnB”], legend_label=“JohnB”, line_width=2, color=“yellow”)
p2.add_tools(HoverTool(tooltips=[(“MatchesB”,"@y")],mode = “vline”))
p3 = figure(title=“Tennis”, x_axis_label=“Time [0.1s]”, y_axis_label=“Matches”, width=1800, height=300, x_range=p1.x_range)

add a line renderer with legend and line thickness

p3.line(x,series[“JeoffC”], legend_label=“JeoffC”, line_width=2, color=“magenta”)
p3.add_tools(HoverTool(tooltips=[(“MatchesC”,"@y")],mode = “vline”))

show the results

show(column(p1,p2,p3))

Hi @Foglia please edit your post to use code formatting so that the code is intelligible (either with the </> icon on the editing toolbar, or triple backtick ``` fences around the code blocks)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.