import numpy as np
from bokeh.layouts import gridplot
from bokeh.plotting import figure, show
from bokeh.io import output_notebook
# Enable output in notebook
output_notebook()
# Define data
x = np.linspace(0, 4 * np.pi, 100)
y = np.sin(x)
# Define tools
TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select"
# Create first plot
p1 = figure(title="Example 1", tools=TOOLS)
p1.circle(x, y, legend_label="sin(x)")
p1.circle(x, 2 * y, legend_label="2*sin(x)", color="orange")
p1.circle(x, 3 * y, legend_label="3*sin(x)", color="green")
p1.legend.title = "Markers"
# Create second plot
p2 = figure(title="Example 2", tools=TOOLS)
p2.circle(x, y, legend_label="sin(x)")
p2.line(x, y, legend_label="sin(x)")
p2.line(x, 2 * y, legend_label="2*sin(x)", line_dash=(4, 4), line_color="orange",
line_width=2)
p2.square(x, 3 * y, legend_label="3*sin(x)", fill_color=None, line_color="green")
p2.line(x, 3 * y, legend_label="3*sin(x)", line_color="green")
p2.legend.title = "Lines"
# Display plots
grid = gridplot([p1, p2], ncols=2, width=400, height=400)
show(grid)