Skip to content

Commit 0a4f54d

Browse files
chore(altair): update quality score 85 and review feedback for sankey-basic
1 parent ad4bd8c commit 0a4f54d

2 files changed

Lines changed: 265 additions & 10 deletions

File tree

plots/sankey-basic/implementations/python/altair.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
"""anyplot.ai
1+
""" anyplot.ai
22
sankey-basic: Basic Sankey Diagram
3-
Library: altair | Python 3.13
4-
Quality: 91/100 | Updated: 2026-04-30
3+
Library: altair 6.1.0 | Python 3.13.13
4+
Quality: 85/100 | Updated: 2026-04-30
55
"""
66

77
import os
Lines changed: 262 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# Per-library metadata for altair implementation of sankey-basic
2-
# Auto-generated by impl-generate.yml
3-
41
library: altair
52
language: python
63
specification_id: sankey-basic
74
created: '2025-12-23T19:50:52Z'
8-
updated: '2026-04-30T08:58:24Z'
5+
updated: '2026-04-30T09:06:47Z'
96
generated_by: claude-sonnet
107
workflow_run: 25156438466
118
issue: 810
@@ -15,7 +12,265 @@ preview_url_light: https://storage.googleapis.com/anyplot-images/plots/sankey-ba
1512
preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/sankey-basic/python/altair/plot-dark.png
1613
preview_html_light: https://storage.googleapis.com/anyplot-images/plots/sankey-basic/python/altair/plot-light.html
1714
preview_html_dark: https://storage.googleapis.com/anyplot-images/plots/sankey-basic/python/altair/plot-dark.html
18-
quality_score: null
15+
quality_score: 85
1916
review:
20-
strengths: []
21-
weaknesses: []
17+
strengths:
18+
- Custom Sankey implementation in Altair (no native Sankey support) using smooth
19+
bezier/smoothstep curves — technically impressive
20+
- 'Source node colors follow Okabe-Ito canonical order: Coal=#009E73, Gas=#D55E00,
21+
Nuclear=#0072B2, Renewable=#CC79A7'
22+
- 'Both renders are fully theme-adaptive with correct backgrounds (#FAF8F1 light
23+
/ #1A1A17 dark) and readable text in both themes'
24+
- All font sizes explicitly set (title=28px, subtitle=20px, node labels=20px bold,
25+
legend title=18px, legend labels=16px)
26+
- 'Correct title format: ''sankey-basic · altair · anyplot.ai'' with descriptive
27+
subtitle'
28+
- Interactive tooltips on nodes and HTML export alongside PNG — leverages Altair's
29+
interactive capabilities
30+
- Realistic energy flow domain (Coal/Gas/Nuclear/Renewable → Residential/Commercial/Industrial/Transport)
31+
with plausible values
32+
- Layer composition with alt.layer() is idiomatic Altair; detail encoding correctly
33+
groups flow polygons per source-target pair
34+
weaknesses:
35+
- 'Target node colors (#7EC8C8, #A8D8A8, #E8C07A, #C8A8E8) are custom hexes not
36+
in Okabe-Ito palette — use Okabe-Ito positions 5–7 (#E69F00, #56B4E9, #F0E442)
37+
and adaptive neutral for the 4 target nodes'
38+
- No visual emphasis or storytelling — the dominant flow (Coal→Industrial, value=45)
39+
is the single largest flow but receives no special treatment; no focal point guides
40+
the viewer
41+
- 'Node ordering creates maximum crossing: sorting source/target nodes to minimize
42+
crossings would improve readability'
43+
- Top-gap between subtitle and diagram is slightly large (top_margin=100 creates
44+
visible dead space under the subtitle text); compact layout would better utilize
45+
canvas
46+
- 'DE-03 is default (data displayed, no hierarchy): adding subtle emphasis to the
47+
largest flow or highlighting one key insight would elevate storytelling'
48+
image_description: |-
49+
Light render (plot-light.png):
50+
Background: Warm off-white (#FAF8F1) — correct, not pure white.
51+
Chrome: Title "sankey-basic · altair · anyplot.ai" in bold dark text; subtitle "Energy Flow from Sources to Sectors" in dark-gray. All text clearly readable against the light background. Node labels (Renewable, Nuclear, Gas, Coal on left; Transport, Industrial, Commercial, Residential on right) are 20px bold dark text — fully readable.
52+
Data: Source nodes colored Okabe-Ito canonical order: Coal (#009E73 green-teal, bottom-left), Gas (#D55E00 orange, middle-left), Nuclear (#0072B2 blue, upper-middle-left), Renewable (#CC79A7 pink-purple, top-left). Flow bands inherit source colors with opacity=0.55. Target nodes use custom colors: Residential=teal, Commercial=light-green, Industrial=warm-tan, Transport=light-purple. Legend box (bottom-right) shows "Energy Source" with correct color swatches. Significant flow crossing visible in the center (X-pattern) — inherent to full mesh of 4 sources × 4 targets.
53+
Legibility verdict: PASS — all text dark on off-white, no contrast failures.
54+
55+
Dark render (plot-dark.png):
56+
Background: Near-black (#1A1A17) — correct, not pure black.
57+
Chrome: Title and subtitle in light/white text — readable. Node labels in light (#F0EFE8) text — no dark-on-dark failures detected. Legend box has dark elevated background (#242420) with light-colored text.
58+
Data: Data colors are the same underlying hex values as light render (theme-constant). Due to opacity=0.55 alpha-blending on flow bands, colors appear visually darker/more saturated against the dark background (expected blending behavior). Node rectangles remain clearly visible with INK_SOFT borders. Flow crossing pattern identical to light render.
59+
Legibility verdict: PASS — all text is light on dark, no dark-on-dark failures.
60+
criteria_checklist:
61+
visual_quality:
62+
score: 27
63+
max: 30
64+
items:
65+
- id: VQ-01
66+
name: Text Legibility
67+
score: 8
68+
max: 8
69+
passed: true
70+
comment: 'All font sizes explicitly set: title=28px, subtitle=20px, node labels=20px
71+
bold, legend title=18px, legend labels=16px. Readable in both themes.'
72+
- id: VQ-02
73+
name: No Overlap
74+
score: 6
75+
max: 6
76+
passed: true
77+
comment: No overlapping text. Source and target labels positioned outside
78+
the crossing flow area. Legend well-placed.
79+
- id: VQ-03
80+
name: Element Visibility
81+
score: 5
82+
max: 6
83+
passed: true
84+
comment: All elements visible. Flow bands opacity=0.55 appropriate for crossing
85+
flows. Individual flow tracing is difficult due to the X-crossing pattern,
86+
but this is inherent to the full-mesh Sankey layout.
87+
- id: VQ-04
88+
name: Color Accessibility
89+
score: 2
90+
max: 2
91+
passed: true
92+
comment: Okabe-Ito source colors are CVD-safe. Flow bands distinguishable
93+
by hue + position.
94+
- id: VQ-05
95+
name: Layout & Canvas
96+
score: 3
97+
max: 4
98+
passed: true
99+
comment: Diagram fills ~80% of canvas horizontally and ~75% vertically. Slight
100+
dead-space gap between subtitle and diagram start due to top_margin=100.
101+
- id: VQ-06
102+
name: Axis Labels & Title
103+
score: 2
104+
max: 2
105+
passed: true
106+
comment: Correct title format. Node names serve as labels. Subtitle describes
107+
the flow context. No traditional axes needed for Sankey.
108+
- id: VQ-07
109+
name: Palette Compliance
110+
score: 1
111+
max: 2
112+
passed: false
113+
comment: 'Source flow colors follow Okabe-Ito canonical order (Coal=#009E73,
114+
Gas=#D55E00, Nuclear=#0072B2, Renewable=#CC79A7). However, target node colors
115+
(#7EC8C8, #A8D8A8, #E8C07A, #C8A8E8) are custom hexes not in Okabe-Ito palette.
116+
Both backgrounds are theme-correct. Partial compliance.'
117+
design_excellence:
118+
score: 11
119+
max: 20
120+
items:
121+
- id: DE-01
122+
name: Aesthetic Sophistication
123+
score: 5
124+
max: 8
125+
passed: true
126+
comment: Above generic default — building a full Sankey from scratch in Altair
127+
demonstrates thoughtful implementation. Good color scheme for sources. Target
128+
node custom colors reduce coherence. Not publication-ready.
129+
- id: DE-02
130+
name: Visual Refinement
131+
score: 4
132+
max: 6
133+
passed: true
134+
comment: No grid lines (appropriate), no spines, smooth bezier curves, opacity-blended
135+
flows, node borders with INK_SOFT. Good refinement above defaults but top
136+
gap reduces polish.
137+
- id: DE-03
138+
name: Data Storytelling
139+
score: 2
140+
max: 6
141+
passed: false
142+
comment: Data displayed correctly but no visual hierarchy or emphasis. The
143+
largest single flow (Coal→Industrial, value=45) is not highlighted. Crossing
144+
node order creates a maximally complex visual without guiding the viewer
145+
to any insight.
146+
spec_compliance:
147+
score: 15
148+
max: 15
149+
items:
150+
- id: SC-01
151+
name: Plot Type
152+
score: 5
153+
max: 5
154+
passed: true
155+
comment: Correct Sankey diagram with proportional flow band widths and smooth
156+
curves.
157+
- id: SC-02
158+
name: Required Features
159+
score: 4
160+
max: 4
161+
passed: true
162+
comment: Source nodes, target nodes, proportional values, distinct source
163+
colors, link opacity for crossings — all present.
164+
- id: SC-03
165+
name: Data Mapping
166+
score: 3
167+
max: 3
168+
passed: true
169+
comment: All 12 flows correctly represented. Band widths proportional to values.
170+
All nodes visible.
171+
- id: SC-04
172+
name: Title & Legend
173+
score: 3
174+
max: 3
175+
passed: true
176+
comment: 'Title: ''sankey-basic · altair · anyplot.ai'' correct. Legend shows
177+
Energy Source with correct Okabe-Ito color swatches.'
178+
data_quality:
179+
score: 15
180+
max: 15
181+
items:
182+
- id: DQ-01
183+
name: Feature Coverage
184+
score: 6
185+
max: 6
186+
passed: true
187+
comment: 'Shows all Sankey aspects: multiple sources, multiple targets, varying
188+
flow magnitudes, crossing flows, proportional node heights.'
189+
- id: DQ-02
190+
name: Realistic Context
191+
score: 5
192+
max: 5
193+
passed: true
194+
comment: Real-world energy flow scenario (Coal/Gas/Nuclear/Renewable → Residential/Commercial/Industrial/Transport).
195+
Neutral domain.
196+
- id: DQ-03
197+
name: Appropriate Scale
198+
score: 4
199+
max: 4
200+
passed: true
201+
comment: Values 10–45 units. Coal→Industrial (45) being the dominant industrial
202+
flow is realistic. Proportions plausible for energy sector distribution.
203+
code_quality:
204+
score: 10
205+
max: 10
206+
items:
207+
- id: CQ-01
208+
name: KISS Structure
209+
score: 3
210+
max: 3
211+
passed: true
212+
comment: 'Linear structure: imports → data → geometry computation → chart
213+
layers → save. No functions or classes.'
214+
- id: CQ-02
215+
name: Reproducibility
216+
score: 2
217+
max: 2
218+
passed: true
219+
comment: Fully deterministic — all data is hardcoded, no random generation
220+
needed.
221+
- id: CQ-03
222+
name: Clean Imports
223+
score: 2
224+
max: 2
225+
passed: true
226+
comment: Only os, altair, pandas imported and all are used.
227+
- id: CQ-04
228+
name: Code Elegance
229+
score: 2
230+
max: 2
231+
passed: true
232+
comment: The bezier geometry computation (~100 lines) is appropriate complexity
233+
for a custom Sankey in a library with no native Sankey support. No fake
234+
UI elements.
235+
- id: CQ-05
236+
name: Output & API
237+
score: 1
238+
max: 1
239+
passed: true
240+
comment: Saves plot-{THEME}.png (scale_factor=3.0) and plot-{THEME}.html.
241+
Correct altair API.
242+
library_mastery:
243+
score: 7
244+
max: 10
245+
items:
246+
- id: LM-01
247+
name: Idiomatic Usage
248+
score: 4
249+
max: 5
250+
passed: true
251+
comment: Uses alt.layer() composition, detail encoding for flow grouping,
252+
mark_line(filled=True) for polygon fills, mark_rect for nodes, mark_text
253+
for labels — all idiomatic Altair patterns.
254+
- id: LM-02
255+
name: Distinctive Features
256+
score: 3
257+
max: 5
258+
passed: true
259+
comment: detail:N encoding for grouping polygon paths, alt.layer() multi-layer
260+
composition, interactive tooltips on nodes, dual PNG+HTML output — several
261+
Altair-distinctive features leveraged.
262+
verdict: REJECTED
263+
impl_tags:
264+
dependencies: []
265+
techniques:
266+
- html-export
267+
- layer-composition
268+
- hover-tooltips
269+
- bezier-curves
270+
patterns:
271+
- data-generation
272+
- iteration-over-groups
273+
dataprep: []
274+
styling:
275+
- alpha-blending
276+
- minimal-chrome

0 commit comments

Comments
 (0)