Skip to content

Commit 9006914

Browse files
feat(bokeh): implement scatter-basic
1 parent 1565d81 commit 9006914

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
scatter-basic: Basic Scatter Plot
3+
Library: bokeh
4+
"""
5+
6+
import numpy as np
7+
from bokeh.io import export_png
8+
from bokeh.models import ColumnDataSource
9+
from bokeh.plotting import figure
10+
11+
12+
# Data
13+
np.random.seed(42)
14+
x = np.random.randn(100) * 2 + 10
15+
y = x * 0.8 + np.random.randn(100) * 2
16+
17+
source = ColumnDataSource(data={"x": x, "y": y})
18+
19+
# Create figure (4800 × 2700 px for 16:9 aspect ratio)
20+
p = figure(width=4800, height=2700, title="Basic Scatter Plot", x_axis_label="X Value", y_axis_label="Y Value")
21+
22+
# Plot scatter
23+
p.scatter(x="x", y="y", source=source, size=12, color="#306998", alpha=0.7)
24+
25+
# Styling
26+
p.title.text_font_size = "20pt"
27+
p.xaxis.axis_label_text_font_size = "20pt"
28+
p.yaxis.axis_label_text_font_size = "20pt"
29+
p.xaxis.major_label_text_font_size = "16pt"
30+
p.yaxis.major_label_text_font_size = "16pt"
31+
p.grid.grid_line_alpha = 0.3
32+
33+
# Save
34+
export_png(p, filename="plot.png")

0 commit comments

Comments
 (0)