Here is the basic example I would like to run.
I expect to have a linked x axis for both plots.
https://jsfiddle.net/PBrockmann/hvmcptke/
This exemple works in python, but I have a lot of interactivity on the browser side so I prefer to work with bokehJS for this specific project.
import numpy as np
from bokeh.models import Legend, DataRange1d
from bokeh.plotting import figure, show, output_file, gridplot
x = np.linspace(0, 4*np.pi, 100)
y = np.sin(x)
output_file("legend_labels.html")
#===================================================
xdr = DataRange1d(bounds=None)
#===================================================
p1 = figure(
plot_width = 400,
plot_height = 400,
tools = "pan,wheel_zoom,box_zoom,reset,save",
toolbar_location = "above",
active_scroll = "wheel_zoom",
x_range = xdr
)
r0 = p1.circle(x, y)
r1 = p1.line(x, y)
r2 = p1.line(x, 2*y, line_dash=[4, 4], line_color="orange", line_width=2)
r3 = p1.square(x, 3*y, fill_color=None, line_color="green")
r4 = p1.line(x, 3*y, line_color="green")
legend = Legend(items=[
("sin(x)", [r0, r1]),
("2*sin(x)", [r2]),
("3*sin(x)", [r3, r4])
], location=(0,0))
p1.toolbar.logo = None
p1.add_layout(legend, 'right')
#===================================================
p2 = figure(
plot_width = 400,
plot_height = 400,
tools = "pan,wheel_zoom,box_zoom,reset,save",
toolbar_location = "above",
active_scroll = "wheel_zoom",
x_range = xdr
)
r3 = p2.square(x, 3*y, fill_color=None, line_color="green")
r4 = p2.line(x, 3*y, line_color="green")
legend = Legend(items=[
("3*sin(x)", [r3, r4])
], location=(0,0))
p2.add_layout(legend, 'right')
#===================================================
p = gridplot([[p1, p2]])
show(p)