Skip to content

Commit 195bbc7

Browse files
update(area-basic): bokeh — comprehensive quality review (#4174)
## Summary Updated **bokeh** implementation for **area-basic**. ### Changes - Added HoverTool with formatted date/visitor tooltips - Added invisible scatter layer for precise hover targets - Improved y-axis label with units "(count)" ## Test Plan - [x] Preview images uploaded to GCS staging - [x] Implementation file passes ruff format/check - [x] Metadata YAML updated with current versions - [ ] Automated review triggered --- Generated with [Claude Code](https://claude.com/claude-code) `/update` command --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 761f982 commit 195bbc7

2 files changed

Lines changed: 88 additions & 71 deletions

File tree

plots/area-basic/implementations/bokeh.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
""" pyplots.ai
22
area-basic: Basic Area Chart
3-
Library: bokeh 3.8.1 | Python 3.13.11
3+
Library: bokeh 3.8.2 | Python 3.14.2
44
Quality: 92/100 | Created: 2025-12-23
55
"""
66

77
import numpy as np
88
import pandas as pd
99
from bokeh.io import export_png, output_file, save
10-
from bokeh.models import ColumnDataSource
10+
from bokeh.models import ColumnDataSource, HoverTool
1111
from bokeh.plotting import figure
1212

1313

@@ -29,7 +29,7 @@
2929
height=2700,
3030
title="area-basic · bokeh · pyplots.ai",
3131
x_axis_label="Date",
32-
y_axis_label="Daily Visitors",
32+
y_axis_label="Daily Visitors (count)",
3333
x_axis_type="datetime",
3434
)
3535

@@ -39,6 +39,17 @@
3939
# Line on top for clear edge
4040
p.line(x="date", y="visitors", source=source, line_color="#306998", line_width=5)
4141

42+
# Invisible scatter for hover targets
43+
p.scatter(x="date", y="visitors", source=source, size=20, fill_alpha=0, line_alpha=0)
44+
45+
# HoverTool for interactive exploration
46+
hover = HoverTool(
47+
tooltips=[("Date", "@date{%b %d, %Y}"), ("Visitors", "@visitors{0,0}")],
48+
formatters={"@date": "datetime"},
49+
mode="vline",
50+
)
51+
p.add_tools(hover)
52+
4253
# Styling for 4800x2700 px - scaled up for large canvas
4354
p.title.text_font_size = "48pt"
4455
p.xaxis.axis_label_text_font_size = "36pt"
Lines changed: 74 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,106 @@
11
library: bokeh
22
specification_id: area-basic
33
created: '2025-12-23T00:48:55Z'
4-
updated: '2025-12-23T01:22:02Z'
5-
generated_by: claude-opus-4-5-20251101
4+
updated: '2026-02-11T22:26:52Z'
5+
generated_by: claude-opus-4-6
66
workflow_run: 20447970023
77
issue: 0
8-
python_version: 3.13.11
9-
library_version: 3.8.1
8+
python_version: 3.14.2
9+
library_version: 3.8.2
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/area-basic/bokeh/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/area-basic/bokeh/plot_thumb.png
1212
preview_html: https://storage.googleapis.com/pyplots-images/plots/area-basic/bokeh/plot.html
1313
quality_score: 92
1414
impl_tags:
1515
dependencies: []
16-
techniques: []
16+
techniques:
17+
- hover-tooltips
18+
- html-export
1719
patterns:
18-
- data-generation
19-
- columndatasource
20-
dataprep: []
20+
- data-generation
21+
- columndatasource
22+
dataprep:
23+
- time-series
2124
styling:
22-
- alpha-blending
23-
- grid-styling
25+
- alpha-blending
26+
- grid-styling
2427
review:
2528
strengths:
26-
- Excellent text sizing scaled appropriately for 4800x2700 canvas
27-
- Clean KISS code structure with proper seed for reproducibility
28-
- Realistic website traffic data with believable weekly patterns and upward trend
29-
- Proper use of Bokeh varea() for area fill with line overlay for definition
30-
- Semi-transparent fill (0.4) matches spec recommendation (0.3-0.5)
31-
- Y-axis correctly starts at 0 for honest area representation
29+
- Excellent text scaling for 4800x2700 canvas with font sizes well above minimums
30+
- 'Good use of Bokeh-specific features: ColumnDataSource, varea, HoverTool with
31+
vline mode, invisible scatter for hover targets'
32+
- Realistic data generation with trend + weekly seasonality + noise components
33+
- Clean code structure following KISS principle with proper seed for reproducibility
34+
- Semi-transparent fill at alpha 0.4 provides good readability while maintaining
35+
visual weight
36+
- Y-axis properly starts at 0 to avoid misleading area representation
37+
- Dual export (PNG + HTML) leverages Bokeh interactive capabilities
3238
weaknesses:
33-
- Missing HoverTool for interactivity - Bokeh key strength is interactive exploration
34-
- Axis labels lack units (could be Daily Visitors count or similar)
35-
- Large empty space below data since values range 4000-7000 but y starts at 0
36-
image_description: The plot displays a basic area chart showing daily website visitors
37-
over January 2024. The filled area uses a steel blue color (#306998) with 40%
38-
transparency, creating visual weight that emphasizes the magnitude of visitor
39-
counts. A solid line traces the top edge of the area for clear definition. The
40-
x-axis shows dates from Jan 01, 2024 to Feb 01, with clear date labels. The y-axis
41-
displays "Daily Visitors" ranging from 0 to approximately 7000. The title "area-basic
42-
· bokeh · pyplots.ai" appears in the top left. The data exhibits a realistic weekly
43-
cyclical pattern (weekend dips) with an overall upward trend across the month.
44-
Subtle dashed grid lines aid value estimation. The y-axis correctly starts at
45-
0, which is essential for area charts to avoid misleading representations.
39+
- Data could show more dramatic variation or events (e.g., a traffic spike or dip)
40+
to better demonstrate the area chart ability to convey magnitude changes
41+
- Font sizes exceed the bokeh.md library guide recommendations (48pt vs 28pt title,
42+
36pt vs 22pt labels) — while readable, they are larger than the standard
43+
image_description: The plot displays a basic area chart titled "area-basic · bokeh
44+
· pyplots.ai" showing daily website visitors over January 2024. The x-axis shows
45+
dates from Jan 01, 2024 to Feb 01, with major ticks at weekly intervals. The y-axis
46+
is labeled "Daily Visitors (count)" and ranges from 0 to approximately 7,000.
47+
The area below the line is filled with a semi-transparent blue (#306998, alpha
48+
0.4), and a solid blue line (line_width=5) traces the top edge of the filled area.
49+
The data exhibits a clear weekly cyclical pattern with an overall upward trend,
50+
starting around 5,000 visitors and ending near 7,000. Dashed grid lines are visible
51+
at low opacity (alpha 0.3). The layout is well-balanced with the plot filling
52+
a large portion of the 4800x2700 canvas. All text is clearly legible with appropriately
53+
scaled font sizes (title 48pt, axis labels 36pt, tick labels 28pt). The toolbar
54+
is removed for a clean static export.
4655
criteria_checklist:
4756
visual_quality:
48-
score: 37
57+
score: 40
4958
max: 40
5059
items:
5160
- id: VQ-01
5261
name: Text Legibility
5362
score: 10
5463
max: 10
5564
passed: true
56-
comment: Title at 48pt, axis labels at 36pt, tick labels at 28pt - all perfectly
57-
readable at 4800x2700
65+
comment: Title 48pt, axis labels 36pt, tick labels 28pt all well above minimums
66+
and perfectly readable
5867
- id: VQ-02
5968
name: No Overlap
6069
score: 8
6170
max: 8
6271
passed: true
63-
comment: No overlapping text elements; date labels are well-spaced
72+
comment: No overlapping text; date ticks well-spaced at weekly intervals
6473
- id: VQ-03
6574
name: Element Visibility
6675
score: 8
6776
max: 8
6877
passed: true
69-
comment: Area fill and line are perfectly visible; line width of 5 appropriate
70-
for canvas size
78+
comment: Area fill clearly visible with good alpha, line_width=5 provides
79+
clear edge definition for 31 data points
7180
- id: VQ-04
7281
name: Color Accessibility
7382
score: 5
7483
max: 5
7584
passed: true
76-
comment: Single color scheme, good contrast against white background
85+
comment: Single blue color (#306998), no accessibility concerns
7786
- id: VQ-05
7887
name: Layout Balance
79-
score: 4
88+
score: 5
8089
max: 5
8190
passed: true
82-
comment: Good proportions, slight excess whitespace at bottom due to y starting
83-
at 0 but data ranging 4000-7000
91+
comment: Plot fills >50% of canvas, balanced margins with min_border adjustments
8492
- id: VQ-06
8593
name: Axis Labels
86-
score: 1
94+
score: 2
8795
max: 2
8896
passed: true
89-
comment: '"Daily Visitors" and "Date" are descriptive but lack units'
97+
comment: Date and Daily Visitors (count) — descriptive with units
9098
- id: VQ-07
9199
name: Grid & Legend
92-
score: 1
100+
score: 2
93101
max: 2
94102
passed: true
95-
comment: Grid is subtle (alpha 0.3) with nice dashed styling; no legend needed
96-
for single series
103+
comment: Subtle dashed grid at alpha 0.3, no legend needed for single series
97104
spec_compliance:
98105
score: 25
99106
max: 25
@@ -103,63 +110,62 @@ review:
103110
score: 8
104111
max: 8
105112
passed: true
106-
comment: Correct area chart with filled region below line
113+
comment: Correct area chart with filled region below the line using varea
107114
- id: SC-02
108115
name: Data Mapping
109116
score: 5
110117
max: 5
111118
passed: true
112-
comment: Datetime on x-axis, numeric values on y-axis
119+
comment: X=datetime (dates), Y=numeric (visitors) correctly assigned
113120
- id: SC-03
114121
name: Required Features
115122
score: 5
116123
max: 5
117124
passed: true
118-
comment: Semi-transparent fill (0.4), gridlines present, clear axis labels,
119-
line on top
125+
comment: Semi-transparent fill (alpha 0.4), gridlines, clear axis labels with
126+
units all present
120127
- id: SC-04
121128
name: Data Range
122129
score: 3
123130
max: 3
124131
passed: true
125-
comment: All data visible, y-axis starts at 0
132+
comment: Y-axis starts at 0, all data visible, full date range shown
126133
- id: SC-05
127134
name: Legend Accuracy
128135
score: 2
129136
max: 2
130137
passed: true
131-
comment: N/A for single series, no misleading elements
138+
comment: No legend needed for single-series area chart
132139
- id: SC-06
133140
name: Title Format
134141
score: 2
135142
max: 2
136143
passed: true
137-
comment: Correctly formatted as "area-basic · bokeh · pyplots.ai"
144+
comment: area-basic · bokeh · pyplots.ai matches required format
138145
data_quality:
139-
score: 18
146+
score: 19
140147
max: 20
141148
items:
142149
- id: DQ-01
143150
name: Feature Coverage
144151
score: 7
145152
max: 8
146153
passed: true
147-
comment: Shows trend, cyclical pattern, and magnitude well; could show more
148-
dramatic variations
154+
comment: Shows upward trend, weekly cyclical pattern, and noise; could show
155+
more dramatic variation
149156
- id: DQ-02
150157
name: Realistic Context
151158
score: 7
152159
max: 7
153160
passed: true
154-
comment: Website traffic with weekly patterns and growth trend is a real,
155-
comprehensible scenario
161+
comment: Daily website visitors over a month — matches spec example application
162+
exactly
156163
- id: DQ-03
157164
name: Appropriate Scale
158-
score: 4
165+
score: 5
159166
max: 5
160167
passed: true
161-
comment: Values 4000-7000 visitors/day plausible; base of 5000 perhaps high
162-
for "basic" example
168+
comment: 4000-7000 daily visitors is realistic for a mid-sized website
163169
code_quality:
164170
score: 10
165171
max: 10
@@ -169,7 +175,7 @@ review:
169175
score: 3
170176
max: 3
171177
passed: true
172-
comment: Clean importsdataplotsave structure, no functions/classes
178+
comment: 'Linear flow: imports, data, plot, save no functions or classes'
173179
- id: CQ-02
174180
name: Reproducibility
175181
score: 3
@@ -181,28 +187,28 @@ review:
181187
score: 2
182188
max: 2
183189
passed: true
184-
comment: All imports are used
190+
comment: All imports used (numpy, pandas, bokeh.io, bokeh.models, bokeh.plotting)
185191
- id: CQ-04
186192
name: No Deprecated API
187193
score: 1
188194
max: 1
189195
passed: true
190-
comment: Uses current Bokeh API
196+
comment: All current Bokeh 3.x API
191197
- id: CQ-05
192198
name: Output Correct
193199
score: 1
194200
max: 1
195201
passed: true
196-
comment: Saves as plot.png and plot.html
202+
comment: Saves as plot.png via export_png
197203
library_features:
198-
score: 2
204+
score: 4
199205
max: 5
200206
items:
201207
- id: LF-01
202208
name: Distinctive Features
203-
score: 2
209+
score: 4
204210
max: 5
205-
passed: false
206-
comment: Uses varea() and ColumnDataSource correctly, but doesn't leverage
207-
Bokeh's interactive features like HoverTool which would enhance the visualization
211+
passed: true
212+
comment: ColumnDataSource, varea, HoverTool with datetime formatter, invisible
213+
scatter for hover targets, dual HTML+PNG export
208214
verdict: APPROVED

0 commit comments

Comments
 (0)