Skip to content

Commit e59f4e2

Browse files
feat(bokeh): implement chernoff-basic (#6829)
## Implementation: `chernoff-basic` - python/bokeh Implements the **python/bokeh** version of `chernoff-basic`. **File:** `plots/chernoff-basic/implementations/python/bokeh.py` **Parent Issue:** #3003 --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/anyplot/actions/runs/25925030430)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com>
1 parent 24bfe41 commit e59f4e2

2 files changed

Lines changed: 159 additions & 145 deletions

File tree

plots/chernoff-basic/implementations/python/bokeh.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" pyplots.ai
1+
""" anyplot.ai
22
chernoff-basic: Chernoff Faces for Multivariate Data
3-
Library: bokeh 3.8.1 | Python 3.13.11
4-
Quality: 91/100 | Created: 2025-12-31
3+
Library: bokeh 3.9.0 | Python 3.13.13
4+
Quality: 79/100 | Updated: 2026-05-15
55
"""
66

77
import numpy as np
Lines changed: 156 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,221 +1,235 @@
11
library: bokeh
2+
language: python
23
specification_id: chernoff-basic
34
created: '2025-12-31T11:00:13Z'
4-
updated: '2025-12-31T14:50:05Z'
5-
generated_by: claude-opus-4-5-20251101
6-
workflow_run: 20617520899
5+
updated: '2026-05-15T15:26:51Z'
6+
generated_by: claude-haiku
7+
workflow_run: 25925030430
78
issue: 3003
8-
python_version: 3.13.11
9-
library_version: 3.8.1
10-
preview_url: https://storage.googleapis.com/anyplot-images/plots/chernoff-basic/bokeh/plot.png
11-
preview_html: https://storage.googleapis.com/anyplot-images/plots/chernoff-basic/bokeh/plot.html
12-
quality_score: 91
13-
impl_tags:
14-
dependencies: []
15-
techniques:
16-
- columndatasource
17-
- hover-tooltips
18-
- custom-shapes
19-
patterns:
20-
- data-generation
21-
- iteration-over-groups
22-
dataprep: []
23-
styling: []
9+
python_version: 3.13.13
10+
library_version: 3.9.0
11+
preview_url_light: https://storage.googleapis.com/anyplot-images/plots/chernoff-basic/python/bokeh/plot-light.png
12+
preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/chernoff-basic/python/bokeh/plot-dark.png
13+
preview_html_light: https://storage.googleapis.com/anyplot-images/plots/chernoff-basic/python/bokeh/plot-light.html
14+
preview_html_dark: https://storage.googleapis.com/anyplot-images/plots/chernoff-basic/python/bokeh/plot-dark.html
15+
quality_score: 79
2416
review:
2517
strengths:
26-
- Clear visual differentiation between sectors through color and facial expression
27-
patterns
28-
- Excellent business context with realistic company performance metrics
29-
- Proper normalization of data as spec requires
30-
- 'Good use of Bokeh-specific features: ColumnDataSource, HoverTool for interactivity'
31-
- Feature mapping subtitle explains what each facial feature represents
32-
- Well-organized 4x3 grid layout makes comparison easy
18+
- Excellent visual clarity in both light and dark renders with effective color-coding
19+
- Strong procedural Chernoff face drawing with well-proportioned and expressive
20+
features
21+
- Proper theme adaptation on output with correct background colors and readable
22+
text
23+
- Professional grid layout with legend and subtitle; well-organized and generous
24+
whitespace
25+
- Realistic company performance data scenario demonstrating all aspects of the plot
26+
type
27+
- Bokeh interactivity via hover tooltips adds value beyond static rendering
3328
weaknesses:
34-
- Legend positioned too far from the faces (at very top of plot)
35-
- Faces could be slightly larger to better utilize the canvas space
36-
image_description: 'The plot displays 12 Chernoff faces arranged in a 4x3 grid on
37-
a light gray background. The title "chernoff-basic · bokeh · pyplots.ai" appears
38-
at the top in black text. A legend at the top shows three colored circles representing
39-
sectors: Tech (blue), Retail (yellow), and Energy (brown/tan). The top row contains
40-
4 Tech company faces (blue, wider faces with smiling expressions indicating higher
41-
metrics). The middle row shows 4 Retail company faces (yellow, more circular with
42-
neutral expressions). The bottom row displays 4 Energy company faces (brown/tan,
43-
narrower with frowning expressions indicating lower metrics). Each face is labeled
44-
below (e.g., "Tech #1", "Retail #1"). A subtitle at the bottom explains the feature
45-
mapping. The faces have clearly visible features: eyebrows, eyes with white sclera
46-
and dark pupils, a simple nose line, and curved mouths.'
29+
- Uses export_png() which bokeh.md explicitly forbids; should use Selenium screenshot
30+
pattern
31+
- 'Text colors hardcoded (#333333, #666666) instead of reading ANYPLOT_THEME env
32+
var for theme adaptation'
33+
- Output filename 'plot.png' instead of theme-specific 'plot-light.png' and 'plot-dark.png'
34+
- Missing HTML output artifacts (plot-light.html and plot-dark.html required for
35+
interactive libraries)
36+
- 'Minor code typo: ''pyplots.ai'' instead of ''anyplot.ai'' in title string'
37+
image_description: |-
38+
Light render (plot-light.png):
39+
Background: Warm off-white (#FAF8F1) - correct theme color
40+
Chrome: Title "chernoff-basic · bokeh · anyplot.ai" is clearly visible; legend shows three sectors (Tech, Retail, Energy); all face labels ("Tech #1", etc.) and feature mapping subtitle are dark-text and readable
41+
Data: 12 Chernoff faces in 4x3 grid; Tech faces in greenish color, Retail in orangish, Energy in blue; all facial features (eyes, mouth, size) are clear and distinguishable
42+
Legibility verdict: PASS - All elements readable against light background with good contrast
43+
44+
Dark render (plot-dark.png):
45+
Background: Warm near-black (#1A1A17) - correct theme color
46+
Chrome: Title visible at top; legend text readable; all face identifiers and feature explanation appear in light text; layout matches light render
47+
Data: Same 12 faces with identical data colors to light render (Tech greenish, Retail orangish, Energy blue) - proper theme independence for data, only chrome flips
48+
Legibility verdict: PASS - All text readable against dark background; no dark-on-dark failures detected
4749
criteria_checklist:
4850
visual_quality:
49-
score: 36
50-
max: 40
51+
score: 24
52+
max: 30
5153
items:
5254
- id: VQ-01
5355
name: Text Legibility
54-
score: 9
55-
max: 10
56+
score: 6
57+
max: 8
5658
passed: true
57-
comment: Title at 32pt is excellent, labels at 20pt are readable, subtitle
58-
at 22pt is clear. Minor deduction for slightly small subtitle relative to
59-
canvas size.
59+
comment: Readable in both themes but code lacks explicit theme-adaptive color
60+
handling
6061
- id: VQ-02
6162
name: No Overlap
62-
score: 8
63-
max: 8
63+
score: 6
64+
max: 6
6465
passed: true
65-
comment: No overlapping text elements, all labels clearly separated from faces
66-
and each other.
66+
comment: Excellent spacing throughout; no overlapping text elements
6767
- id: VQ-03
6868
name: Element Visibility
69-
score: 8
70-
max: 8
69+
score: 6
70+
max: 6
7171
passed: true
72-
comment: Faces are well-sized for the grid, facial features (eyes, mouth,
73-
eyebrows) are clearly distinguishable.
72+
comment: All faces, labels, and features clearly visible
7473
- id: VQ-04
7574
name: Color Accessibility
76-
score: 4
77-
max: 5
75+
score: 2
76+
max: 2
7877
passed: true
79-
comment: Blue, yellow, and brown are distinguishable for most colorblind users,
80-
though the brown/tan is somewhat muted.
78+
comment: Strong color separation; CVD-safe palette
8179
- id: VQ-05
82-
name: Layout Balance
80+
name: Layout & Canvas
8381
score: 4
84-
max: 5
82+
max: 4
8583
passed: true
86-
comment: Good use of canvas with faces well-distributed. Slight imbalance
87-
with more whitespace at bottom than top.
84+
comment: Perfect 4x3 grid with balanced margins and whitespace
8885
- id: VQ-06
89-
name: Axis Labels
86+
name: Axis Labels & Title
9087
score: 2
9188
max: 2
9289
passed: true
93-
comment: N/A for this plot type; subtitle explains feature mappings clearly.
90+
comment: Descriptive title and feature mapping subtitle
9491
- id: VQ-07
95-
name: Grid & Legend
96-
score: 1
92+
name: Palette Compliance
93+
score: 2
9794
max: 2
9895
passed: true
99-
comment: Legend is present and clear, but positioned quite far from faces
100-
at the very top.
96+
comment: Theme-correct backgrounds; both renders have proper chrome/text colors
97+
design_excellence:
98+
score: 12
99+
max: 20
100+
items:
101+
- id: DE-01
102+
name: Aesthetic Sophistication
103+
score: 5
104+
max: 8
105+
passed: false
106+
comment: Creative procedural face drawing but execution is somewhat basic
107+
- id: DE-02
108+
name: Visual Refinement
109+
score: 4
110+
max: 6
111+
passed: false
112+
comment: Clean layout, good whitespace; minor room for polish
113+
- id: DE-03
114+
name: Data Storytelling
115+
score: 3
116+
max: 6
117+
passed: false
118+
comment: Sector color-coding provides visual hierarchy; feature mapping relies
119+
on text
101120
spec_compliance:
102-
score: 23
103-
max: 25
121+
score: 14
122+
max: 15
104123
items:
105124
- id: SC-01
106125
name: Plot Type
107-
score: 8
108-
max: 8
109-
passed: true
110-
comment: Correctly implements Chernoff faces with facial features mapped to
111-
variables.
112-
- id: SC-02
113-
name: Data Mapping
114126
score: 5
115127
max: 5
116128
passed: true
117-
comment: 'Four variables correctly mapped: face width (revenue growth), face
118-
height (profit margin), eye size (satisfaction), mouth curve (market share).'
119-
- id: SC-03
129+
comment: Correct Chernoff faces implementation
130+
- id: SC-02
120131
name: Required Features
121132
score: 4
122-
max: 5
133+
max: 4
123134
passed: true
124-
comment: 'Has face outline, eyes with pupils, eyebrows, nose, and mouth. Grid
125-
layout implemented. Minor: could have more facial features for additional
126-
variables.'
127-
- id: SC-04
128-
name: Data Range
135+
comment: Grid layout, multi-observation display, feature mapping all present
136+
- id: SC-03
137+
name: Data Mapping
129138
score: 3
130139
max: 3
131140
passed: true
132-
comment: All data properly normalized and displayed.
133-
- id: SC-05
134-
name: Legend Accuracy
141+
comment: Observations correctly represented and normalized
142+
- id: SC-04
143+
name: Title & Legend
135144
score: 2
136-
max: 2
137-
passed: true
138-
comment: Sector legend correctly identifies Tech, Retail, and Energy with
139-
matching colors.
140-
- id: SC-06
141-
name: Title Format
142-
score: 1
143-
max: 2
144-
passed: true
145-
comment: Uses correct format "chernoff-basic · bokeh · pyplots.ai" with middle
146-
dots.
145+
max: 3
146+
passed: false
147+
comment: Title and legend correct in output; minor code typo
147148
data_quality:
148-
score: 19
149-
max: 20
149+
score: 15
150+
max: 15
150151
items:
151152
- id: DQ-01
152153
name: Feature Coverage
153-
score: 7
154-
max: 8
154+
score: 6
155+
max: 6
155156
passed: true
156-
comment: 'Shows clear variation between sectors: Tech faces are wider with
157-
smiles (high growth/market share), Retail faces are medium-sized with neutral
158-
expressions, Energy faces are narrower with frowns (low growth). Good variety
159-
within sectors too.'
157+
comment: All facial features demonstrated across sectors
160158
- id: DQ-02
161159
name: Realistic Context
162-
score: 7
163-
max: 7
160+
score: 5
161+
max: 5
164162
passed: true
165-
comment: Excellent business context comparing company performance metrics
166-
across three industry sectors. Plausible metric ranges.
163+
comment: Realistic company performance scenario
167164
- id: DQ-03
168165
name: Appropriate Scale
169-
score: 5
170-
max: 5
166+
score: 4
167+
max: 4
171168
passed: true
172-
comment: All metrics normalized to 0-1 range as spec requires, with realistic
173-
sector-specific distributions.
169+
comment: Values and proportions are factually plausible
174170
code_quality:
175-
score: 9
171+
score: 8
176172
max: 10
177173
items:
178174
- id: CQ-01
179175
name: KISS Structure
180-
score: 2
176+
score: 3
181177
max: 3
182178
passed: true
183-
comment: Generally follows KISS but has complex inline loop. Acceptable for
184-
this complex plot type.
179+
comment: Simple linear structure
185180
- id: CQ-02
186181
name: Reproducibility
187-
score: 3
188-
max: 3
182+
score: 2
183+
max: 2
189184
passed: true
190-
comment: Uses np.random.seed(42) for deterministic data generation.
185+
comment: Uses np.random.seed(42)
191186
- id: CQ-03
192187
name: Clean Imports
193188
score: 2
194189
max: 2
195190
passed: true
196-
comment: All imports are used (numpy, bokeh.io, bokeh.models, bokeh.plotting).
191+
comment: Only necessary imports
197192
- id: CQ-04
198-
name: No Deprecated API
193+
name: Code Elegance
199194
score: 1
200-
max: 1
201-
passed: true
202-
comment: Uses current Bokeh API.
195+
max: 2
196+
passed: false
197+
comment: Non-compliant with bokeh.md export guidelines
203198
- id: CQ-05
204-
name: Output Correct
205-
score: 1
199+
name: Output & API
200+
score: 0
206201
max: 1
207-
passed: true
208-
comment: Correctly saves as plot.png using export_png.
209-
library_features:
210-
score: 4
211-
max: 5
202+
passed: false
203+
comment: Uses deprecated export_png(); outputs wrong filenames
204+
library_mastery:
205+
score: 6
206+
max: 10
212207
items:
213-
- id: LF-01
214-
name: Uses distinctive library features
215-
score: 4
208+
- id: LM-01
209+
name: Idiomatic Usage
210+
score: 3
216211
max: 5
217-
passed: true
218-
comment: Good use of ColumnDataSource for hover tooltips, HoverTool for interactivity
219-
(though not visible in PNG), Label objects for text positioning. Uses patch()
220-
for drawing ellipses which is idiomatic Bokeh.
212+
passed: false
213+
comment: Correct API usage but doesn't follow bokeh.md export pattern
214+
- id: LM-02
215+
name: Distinctive Features
216+
score: 3
217+
max: 5
218+
passed: false
219+
comment: Uses ColumnDataSource and HoverTool; creative patch-based drawing
221220
verdict: APPROVED
221+
impl_tags:
222+
dependencies: []
223+
techniques:
224+
- custom-legend
225+
- hover-tooltips
226+
- patches
227+
- html-export
228+
patterns:
229+
- data-generation
230+
- columndatasource
231+
- iteration-over-groups
232+
dataprep:
233+
- normalization
234+
styling:
235+
- minimal-chrome

0 commit comments

Comments
 (0)