Skip to content

Commit 570907b

Browse files
chore(matplotlib): update quality score 79 and review feedback for sankey-basic
1 parent 33f23ec commit 570907b

2 files changed

Lines changed: 247 additions & 10 deletions

File tree

plots/sankey-basic/implementations/python/matplotlib.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
sankey-basic: Basic Sankey Diagram
3-
Library: matplotlib 3.10.8 | Python 3.13.11
4-
Quality: 91/100 | Created: 2025-12-23
3+
Library: matplotlib 3.10.9 | Python 3.13.13
4+
Quality: 79/100 | Updated: 2026-04-30
55
"""
66

77
import matplotlib.pyplot as plt
Lines changed: 244 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# Per-library metadata for matplotlib implementation of sankey-basic
2-
# Auto-generated by impl-generate.yml
3-
41
library: matplotlib
52
language: python
63
specification_id: sankey-basic
74
created: '2025-12-23T19:45:16Z'
8-
updated: '2026-04-30T08:47:31Z'
5+
updated: '2026-04-30T08:55:45Z'
96
generated_by: claude-sonnet
107
workflow_run: 25156094188
118
issue: 810
@@ -15,7 +12,247 @@ 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/matplotlib/plot-dark.png
1613
preview_html_light: null
1714
preview_html_dark: null
18-
quality_score: null
15+
quality_score: 79
1916
review:
20-
strengths: []
21-
weaknesses: []
17+
strengths:
18+
- Excellent realistic data scenario (national energy flow — the canonical Sankey
19+
use case)
20+
- Good two-stage connected Sankey using matplotlib native prior/connect API
21+
- Energy balance verified with assert — good correctness practice
22+
- Both renders show visually appealing clean layout with proper axis removal
23+
- Clear visual hierarchy between source and distribution stages via two-color scheme
24+
- TWh values on node labels add quantitative context without clutter
25+
weaknesses:
26+
- 'Critical: Code uses #306998 (Python Blue) and #FFD43B (Python Yellow) instead
27+
of Okabe-Ito palette (#009E73 and #D55E00) — VQ-07 hard fail'
28+
- 'Critical: No ANYPLOT_THEME environment variable handling — no theme-adaptive
29+
backgrounds, text colors, or chrome; saves as plot.png not plot-{THEME}.png'
30+
- 'Critical: Code has pyplots.ai in the title instead of anyplot.ai'
31+
- Title has extra National Energy Flow prefix — format must be {spec-id} · {library}
32+
· anyplot.ai
33+
- 'Subtitle uses hardcoded color #555555 which will not adapt to dark theme (should
34+
use INK_MUTED token)'
35+
- No legend creation code despite legend appearing in rendered images (images appear
36+
to be from a different code version)
37+
image_description: |-
38+
Light render (plot-light.png):
39+
Background: Warm off-white (~#FAF8F1) — correct theme surface, NOT pure white
40+
Chrome: Title "National Energy Flow · sankey-basic · matplotlib · anyplot.ai" in dark text, clearly readable; node labels bold dark text; subtitle italic in medium gray; legend with dark text labels — all readable against light background
41+
Data: Left Sankey in teal-green (~#009E73 range), right Sankey in orange-brown (~#D55E00 range); flow widths proportional to TWh values; Coal (120 TWh) largest, Transport (20 TWh) smallest but still distinct
42+
Legibility verdict: PASS — all text clearly readable against warm off-white background
43+
44+
Dark render (plot-dark.png):
45+
Background: Warm near-black (~#1A1A17) — correct theme surface, NOT pure black
46+
Chrome: Title in light-colored text, clearly readable; node labels in light text against dark background; subtitle in lighter gray; legend with light text and dark-elevated box fill — all readable against dark background; NO dark-on-dark failures observed
47+
Data: Colors identical to light render — same teal-green and orange-brown (only chrome flips, data colors stable); brand green remains visible on dark surface
48+
Legibility verdict: PASS — all text clearly readable against near-black background
49+
50+
CRITICAL DISCREPANCY NOTE: The rendered images do NOT match the current code. The code uses #306998 (Python Blue) and #FFD43B (Python Yellow) with no ANYPLOT_THEME handling and saves as plot.png. The images appear to have been generated from a different (earlier, fixed) version of the code. The current code file would produce incorrect output (wrong colors, no theme adaptation, wrong filename) if run now.
51+
criteria_checklist:
52+
visual_quality:
53+
score: 23
54+
max: 30
55+
items:
56+
- id: VQ-01
57+
name: Text Legibility
58+
score: 6
59+
max: 8
60+
passed: true
61+
comment: 'Font sizes explicitly set (18pt bold node labels, 26pt title, 16pt
62+
subtitle); readable in both renders; subtitle uses hardcoded #555555 which
63+
won''t adapt to dark theme'
64+
- id: VQ-02
65+
name: No Overlap
66+
score: 5
67+
max: 6
68+
passed: true
69+
comment: Very minimal crowding between Renewables/Nuclear labels; all content
70+
readable
71+
- id: VQ-03
72+
name: Element Visibility
73+
score: 5
74+
max: 6
75+
passed: true
76+
comment: All flow arrows clearly visible and proportional to TWh values; smallest
77+
flow (Transport 20 TWh) still distinct
78+
- id: VQ-04
79+
name: Color Accessibility
80+
score: 2
81+
max: 2
82+
passed: true
83+
comment: Two distinct colors (green + orange), both colorblind-safe; good
84+
luminance contrast
85+
- id: VQ-05
86+
name: Layout & Canvas
87+
score: 3
88+
max: 4
89+
passed: true
90+
comment: Diagram fills ~70% of canvas, balanced margins; legend placement
91+
slightly floating
92+
- id: VQ-06
93+
name: Axis Labels & Title
94+
score: 2
95+
max: 2
96+
passed: true
97+
comment: Descriptive title; node labels include TWh values as units; no traditional
98+
axes needed for Sankey
99+
- id: VQ-07
100+
name: Palette Compliance
101+
score: 0
102+
max: 2
103+
passed: false
104+
comment: 'FAIL: Code uses #306998 (Python Blue) and #FFD43B (Python Yellow),
105+
not Okabe-Ito; no ANYPLOT_THEME handling; backgrounds and text not theme-adaptive
106+
in code'
107+
design_excellence:
108+
score: 12
109+
max: 20
110+
items:
111+
- id: DE-01
112+
name: Aesthetic Sophistication
113+
score: 4
114+
max: 8
115+
passed: true
116+
comment: Two-color phase scheme creates clear visual distinction; clean professional
117+
look; alpha=0.75 adds depth; above defaults but not publication-exceptional
118+
- id: DE-02
119+
name: Visual Refinement
120+
score: 4
121+
max: 6
122+
passed: true
123+
comment: ax.axis('off') appropriate for Sankey; alpha blending with edge highlighting;
124+
subtitle caption adds polish; clean composition
125+
- id: DE-03
126+
name: Data Storytelling
127+
score: 4
128+
max: 6
129+
passed: true
130+
comment: Two-stage flow narrates energy transformation story; TWh values quantify
131+
the story; subtitle explains flow direction; visual hierarchy from large
132+
(Coal 120) to small (Renewables 30)
133+
spec_compliance:
134+
score: 14
135+
max: 15
136+
items:
137+
- id: SC-01
138+
name: Plot Type
139+
score: 5
140+
max: 5
141+
passed: true
142+
comment: Correct Sankey diagram with proportional flow widths and multi-stage
143+
connections
144+
- id: SC-02
145+
name: Required Features
146+
score: 4
147+
max: 4
148+
passed: true
149+
comment: Distinct colors per stage, link widths proportional to values, node
150+
labels visible, no circular flows, multi-stage flow
151+
- id: SC-03
152+
name: Data Mapping
153+
score: 3
154+
max: 3
155+
passed: true
156+
comment: Energy balance verified with assert; all 9 flows correctly mapped;
157+
correct source-to-target directionality
158+
- id: SC-04
159+
name: Title & Legend
160+
score: 2
161+
max: 3
162+
passed: false
163+
comment: Images show 'National Energy Flow · sankey-basic · matplotlib · anyplot.ai'
164+
— extra prefix before spec-id; code has pyplots.ai (wrong brand)
165+
data_quality:
166+
score: 14
167+
max: 15
168+
items:
169+
- id: DQ-01
170+
name: Feature Coverage
171+
score: 5
172+
max: 6
173+
passed: true
174+
comment: Shows multiple sources with varying magnitudes, generation losses,
175+
and 4 distinct end-use sectors; demonstrates multi-stage flow
176+
- id: DQ-02
177+
name: Realistic Context
178+
score: 5
179+
max: 5
180+
passed: true
181+
comment: National energy flow is the canonical Sankey use case; coal/gas/nuclear/renewables
182+
to generation losses to residential/commercial/industrial/transport is excellent
183+
real-world scenario
184+
- id: DQ-03
185+
name: Appropriate Scale
186+
score: 4
187+
max: 4
188+
passed: true
189+
comment: 300 TWh total with ~33% losses, realistic energy mix proportions,
190+
balanced end-use sectors; energy conservation verified with assert
191+
code_quality:
192+
score: 9
193+
max: 10
194+
items:
195+
- id: CQ-01
196+
name: KISS Structure
197+
score: 3
198+
max: 3
199+
passed: true
200+
comment: 'Clean linear structure: imports -> data constants -> plot -> save;
201+
no functions or classes'
202+
- id: CQ-02
203+
name: Reproducibility
204+
score: 2
205+
max: 2
206+
passed: true
207+
comment: All values are hardcoded constants; fully deterministic
208+
- id: CQ-03
209+
name: Clean Imports
210+
score: 2
211+
max: 2
212+
passed: true
213+
comment: Only matplotlib.pyplot and matplotlib.sankey.Sankey, both used
214+
- id: CQ-04
215+
name: Code Elegance
216+
score: 2
217+
max: 2
218+
passed: true
219+
comment: Clean Pythonic code; assert for energy balance is a nice correctness
220+
guard; appropriate complexity
221+
- id: CQ-05
222+
name: Output & API
223+
score: 0
224+
max: 1
225+
passed: false
226+
comment: 'FAIL: Saves as plt.savefig(''plot.png'') — must be plt.savefig(f''plot-{THEME}.png'')
227+
with ANYPLOT_THEME variable'
228+
library_mastery:
229+
score: 7
230+
max: 10
231+
items:
232+
- id: LM-01
233+
name: Idiomatic Usage
234+
score: 4
235+
max: 5
236+
passed: true
237+
comment: Good use of matplotlib.sankey.Sankey class; correct ax= parameter;
238+
proper use of flows, labels, orientations, pathlengths; sankey.finish()
239+
pattern
240+
- id: LM-02
241+
name: Distinctive Features
242+
score: 3
243+
max: 5
244+
passed: true
245+
comment: Connected two-stage Sankey using prior=0, connect=(5, 0) is distinctive
246+
to matplotlib Sankey API; post-processing diagram texts via diagrams[i].texts
247+
shows library-specific knowledge
248+
verdict: REJECTED
249+
impl_tags:
250+
dependencies: []
251+
techniques:
252+
- annotations
253+
patterns:
254+
- explicit-figure
255+
dataprep: []
256+
styling:
257+
- alpha-blending
258+
- minimal-chrome

0 commit comments

Comments
 (0)