Bokeh-Multiline-Plot-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

# Define data for each line
x = [1, 2, 3, 4, 5]
y1 = [6, 7, 2, 4, 5]
y2 = [1, 4, 3, 2, 6]
y3 = [3, 5, 1, 2, 8]

# Create the figure
multi_line_plot = figure(title="Multiline Plot", x_axis_label='X-Axis', y_axis_label='Y-Axis')

# Plot each line individually with a legend
multi_line_plot.line(x, y1, line_width=2, color="blue", legend_label="Line 1")
multi_line_plot.line(x, y2, line_width=2, color="green", legend_label="Line 2")
multi_line_plot.line(x, y3, line_width=2, color="red", legend_label="Line 3")

# Show the plot
show(multi_line_plot)


Score: 5

Category: bokeh