Boke-Scatterplot-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 ...
# Sample 2: Scatter Plot with Color Mapping
data = {'x': [1, 2, 3, 4, 5],
        'y': [6, 7, 2, 4, 5],
        'size': [10, 20, 30, 40, 50],
        'color': ['red', 'blue', 'green', 'orange', 'purple']}

source = ColumnDataSource(data=data)

scatter_plot = figure(title="Sample Scatter Plot", x_axis_label='X-Axis', y_axis_label='Y-Axis')
scatter_plot.scatter('x', 'y', size='size', color='color', source=source, legend_label="Scatter")

show(scatter_plot)


Score: 5

Category: bokeh