Multiline-Glyb-1

Sat 17 May 2025

from bokeh.plotting import figure, output_file, show
from bokeh.io import output_notebook
from bokeh.models import ColumnDataSource
# Set Bokeh output to notebook
output_notebook()
Loading BokehJS ...
from bokeh.plotting import figure, show
from bokeh.models import ColumnDataSource

# Example data: lists of x and y coordinates for multiple lines
xs = [[1, 2, 3, 4], [2, 3, 4, 5], [3, 4, 5, 6]]  # x-coordinates for 3 lines
ys = [[5, 6, 7, 8], [4, 5, 6, 7], [3, 4, 5, 6]]  # y-coordinates for 3 lines

# Create a Bokeh plot
p = figure(title="Multi-Line Example", x_axis_label="X-axis", y_axis_label="Y-axis")

# Add the multi_line glyph
p.multi_line(xs=xs, ys=ys, line_width=2, color=["red", "green", "blue"])

# Display the plot
show(p)


Score: 5

Category: bokeh