Skip to content

Commit 1f9376d

Browse files
feat(plotly): implement donut-basic (#5338)
## Implementation: `donut-basic` - python/plotly Implements the **python/plotly** version of `donut-basic`. **File:** `plots/donut-basic/implementations/python/plotly.py` **Parent Issue:** #733 --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/anyplot/actions/runs/24873655754)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 7af191b commit 1f9376d

2 files changed

Lines changed: 172 additions & 118 deletions

File tree

plots/donut-basic/implementations/python/plotly.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
donut-basic: Basic Donut Chart
3-
Library: plotly 6.5.0 | Python 3.13.11
4-
Quality: 92/100 | Created: 2025-12-23
3+
Library: plotly 6.7.0 | Python 3.14.4
4+
Quality: 89/100 | Updated: 2026-04-24
55
"""
66

77
import plotly.graph_objects as go
Lines changed: 169 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,184 @@
11
library: plotly
2+
language: python
23
specification_id: donut-basic
34
created: '2025-12-23T00:48:01Z'
4-
updated: '2025-12-23T01:21:10Z'
5-
generated_by: claude-opus-4-5-20251101
6-
workflow_run: 20447959475
7-
issue: 0
8-
python_version: 3.13.11
9-
library_version: 6.5.0
10-
preview_url: https://storage.googleapis.com/anyplot-images/plots/donut-basic/plotly/plot.png
11-
preview_html: https://storage.googleapis.com/anyplot-images/plots/donut-basic/plotly/plot.html
12-
quality_score: 92
13-
impl_tags:
14-
dependencies: []
15-
techniques:
16-
- html-export
17-
patterns:
18-
- explicit-figure
19-
dataprep: []
20-
styling: []
5+
updated: '2026-04-24T05:36:16Z'
6+
generated_by: claude-opus
7+
workflow_run: 24873655754
8+
issue: 733
9+
python_version: 3.14.4
10+
library_version: 6.7.0
11+
preview_url_light: https://storage.googleapis.com/anyplot-images/plots/donut-basic/python/plotly/plot-light.png
12+
preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/donut-basic/python/plotly/plot-dark.png
13+
preview_html_light: https://storage.googleapis.com/anyplot-images/plots/donut-basic/python/plotly/plot-light.html
14+
preview_html_dark: https://storage.googleapis.com/anyplot-images/plots/donut-basic/python/plotly/plot-dark.html
15+
quality_score: 89
2116
review:
2217
strengths:
23-
- Excellent use of center annotation for total budget display
24-
- Clean colorblind-safe color palette with Python blue as primary
25-
- White borders between segments improve visual separation
26-
- Subtle pull effect adds visual interest without distraction
27-
- Both PNG and interactive HTML outputs generated
28-
- Realistic budget allocation scenario
18+
- Perfect Okabe-Ito palette compliance in canonical order, both themes fully correct
19+
- Elegant three-level center annotation (header / bold amount / year) creates a
20+
natural focal point
21+
- Clean no-legend design with outside labels — professional and uncluttered
22+
- Custom Inter font family raises typography above defaults
23+
- 'Excellent theme adaptation: warm off-white and near-black backgrounds, all chrome
24+
tokens applied correctly'
25+
- Realistic, neutral FY2026 budget dataset with plausible proportions (engineering-heavy
26+
tech company)
27+
- Custom hovertemplate with HTML formatting for interactive HTML output
2928
weaknesses:
30-
- Legend positioning creates slight layout imbalance
31-
- Could leverage more Plotly interactivity features like custom hover templates
32-
image_description: The plot displays a donut chart with 6 budget allocation categories
33-
rendered as colored ring segments. The largest segment is Engineering (35%) in
34-
Python blue (#306998), followed by Marketing (20%) in yellow, Operations (15%)
35-
in teal, Sales (15%) in coral/salmon, R&D (10%) in green, and HR (5%) in orange.
36-
Each segment has a slight pull/explosion effect and white borders between segments.
37-
Labels with category names and percentages are positioned outside the ring. The
38-
center contains "Total $100M" in blue text. A vertical legend on the right lists
39-
all categories. The title "donut-basic · plotly · pyplots.ai" appears at the top
40-
center.
29+
- 'Design excellence falls short of 90: the dominant Engineering segment (42%) gets
30+
no visual emphasis — a subtle pull or highlight would guide the eye and lift DE-01
31+
to 6+'
32+
- Three small segments on the right (Operations 10%, R&D 6%, G&A 4%) have labels
33+
that crowd together; auto-margin helps but spacing could be improved
34+
- White segment separator lines are not theme-adaptive — on the dark render they
35+
appear as fixed white rather than matching the surface color
36+
image_description: |-
37+
Light render (plot-light.png):
38+
Background: Warm off-white #FAF8F1 — correct light surface color, not pure white.
39+
Chrome: Title "donut-basic · plotly · anyplot.ai" in dark #1A1A17 text, clearly readable. Outside segment labels (category + %) in dark ink, all readable. Center annotations in three tones: "Total Budget" in muted #4A4A44, "$100M" bold in primary #1A1A17, "FY2026" in tertiary #6B6A63.
40+
Data: Six Okabe-Ito segments — Engineering (42%) #009E73, Sales (24%) #D55E00, Marketing (14%) #0072B2, Operations (10%) #CC79A7, R&D (6%) #E69F00, G&A (4%) #56B4E9. White separator lines between segments. No legend.
41+
Legibility verdict: PASS — all text clearly readable against warm off-white background.
42+
43+
Dark render (plot-dark.png):
44+
Background: Near-black #1A1A17 — correct dark surface color, not pure black.
45+
Chrome: Title in light text, clearly readable against dark background. Segment labels appear in light-colored text. Center annotations visible in appropriately adapted light tones. No dark-on-dark text failures.
46+
Data: Identical six Okabe-Ito colors to light render — #009E73, #D55E00, #0072B2, #CC79A7, #E69F00, #56B4E9 — all clearly visible on the dark background. White separator lines visible (slightly harsh on dark, could be theme-adaptive).
47+
Legibility verdict: PASS — all text readable; no dark-on-dark issues detected.
4148
criteria_checklist:
4249
visual_quality:
43-
score: 36
44-
max: 40
50+
score: 29
51+
max: 30
4552
items:
4653
- id: VQ-01
4754
name: Text Legibility
48-
score: 10
49-
max: 10
55+
score: 8
56+
max: 8
5057
passed: true
51-
comment: Title at 32pt, labels at 20pt, center annotation at 36pt - all clearly
52-
readable
58+
comment: 'All font sizes explicitly set: title 28px, center annotations 56/22/18px,
59+
segment labels 18px. Readable in both themes.'
5360
- id: VQ-02
5461
name: No Overlap
55-
score: 8
56-
max: 8
62+
score: 5
63+
max: 6
5764
passed: true
58-
comment: All labels positioned outside the ring with no overlapping text
65+
comment: Mostly clean; three small right-side segments (Operations, R&D, G&A)
66+
have labels that crowd together without true overlap.
5967
- id: VQ-03
6068
name: Element Visibility
61-
score: 8
62-
max: 8
69+
score: 6
70+
max: 6
6371
passed: true
64-
comment: Ring segments are well-sized with good thickness (hole=0.5), slight
65-
pull effect adds visual separation
72+
comment: Ring width (hole=0.58) is thick and well-proportioned; all six segments
73+
including 4% G&A slice clearly visible.
6674
- id: VQ-04
6775
name: Color Accessibility
68-
score: 5
69-
max: 5
76+
score: 2
77+
max: 2
7078
passed: true
71-
comment: Uses colorblind-safe palette with distinct hues (blue, yellow, teal,
72-
coral, green, orange)
79+
comment: Okabe-Ito palette used, inherently CVD-safe; white segment dividers
80+
add further differentiation.
7381
- id: VQ-05
74-
name: Layout Balance
75-
score: 3
76-
max: 5
82+
name: Layout & Canvas
83+
score: 4
84+
max: 4
85+
passed: true
86+
comment: Donut fills ~65% of canvas, well-centered, generous equal margins
87+
on all sides.
88+
- id: VQ-06
89+
name: Axis Labels & Title
90+
score: 2
91+
max: 2
7792
passed: true
78-
comment: Good overall but the legend positioned far right creates some asymmetry
93+
comment: Title in correct format; no axes applicable to donut chart.
7994
- id: VQ-07
80-
name: Grid & Legend
95+
name: Palette Compliance
8196
score: 2
8297
max: 2
8398
passed: true
84-
comment: Legend well-placed, no grid needed for donut charts
99+
comment: 'First series #009E73, full Okabe-Ito canonical order, #FAF8F1 light
100+
bg, #1A1A17 dark bg, theme-adaptive chrome all correct.'
101+
design_excellence:
102+
score: 13
103+
max: 20
104+
items:
105+
- id: DE-01
106+
name: Aesthetic Sophistication
107+
score: 5
108+
max: 8
109+
passed: true
110+
comment: Custom font (Inter), no legend, three-level center annotation with
111+
size hierarchy — clearly above defaults but lacks focal-point emphasis on
112+
dominant segment.
113+
- id: DE-02
114+
name: Visual Refinement
115+
score: 4
116+
max: 6
117+
passed: true
118+
comment: No legend, white segment dividers, generous margins, appropriate
119+
absence of grid/spines. Some intentional refinement but separator colors
120+
not theme-adaptive.
121+
- id: DE-03
122+
name: Data Storytelling
123+
score: 4
124+
max: 6
125+
passed: true
126+
comment: Center annotation creates focal point; Engineering's 42% arc naturally
127+
dominant. Could be stronger with explicit pull on Engineering segment.
85128
spec_compliance:
86-
score: 25
87-
max: 25
129+
score: 15
130+
max: 15
88131
items:
89132
- id: SC-01
90133
name: Plot Type
91-
score: 8
92-
max: 8
93-
passed: true
94-
comment: Correct donut chart with hollow center
95-
- id: SC-02
96-
name: Data Mapping
97134
score: 5
98135
max: 5
99136
passed: true
100-
comment: Categories and values correctly mapped to segments
101-
- id: SC-03
137+
comment: Correct donut chart via go.Pie(hole=0.58).
138+
- id: SC-02
102139
name: Required Features
103-
score: 5
104-
max: 5
140+
score: 4
141+
max: 4
105142
passed: true
106-
comment: Has percentage labels, center metric ($100M total), consistent ordering
107-
- id: SC-04
108-
name: Data Range
143+
comment: Center annotation, percentage labels, consistent ordering (sort=False),
144+
thick ring width all present.
145+
- id: SC-03
146+
name: Data Mapping
109147
score: 3
110148
max: 3
111149
passed: true
112-
comment: All segments visible, no data cut off
113-
- id: SC-05
114-
name: Legend Accuracy
115-
score: 2
116-
max: 2
117-
passed: true
118-
comment: Legend labels match segment categories
119-
- id: SC-06
120-
name: Title Format
121-
score: 2
122-
max: 2
150+
comment: Categories to labels, values to segment sizes; all data visible.
151+
- id: SC-04
152+
name: Title & Legend
153+
score: 3
154+
max: 3
123155
passed: true
124-
comment: 'Uses correct format: "donut-basic · plotly · pyplots.ai"'
156+
comment: Exact title format; labels-on-segments replace legend appropriately.
125157
data_quality:
126-
score: 18
127-
max: 20
158+
score: 15
159+
max: 15
128160
items:
129161
- id: DQ-01
130162
name: Feature Coverage
131163
score: 6
132-
max: 8
164+
max: 6
133165
passed: true
134-
comment: Shows 6 categories with varying sizes, demonstrates donut chart well
135-
but could show more extreme size contrasts
166+
comment: 'Demonstrates all donut features: varied sizes (4%-42%), center annotation,
167+
outside labels, thick ring.'
136168
- id: DQ-02
137169
name: Realistic Context
138-
score: 7
139-
max: 7
170+
score: 5
171+
max: 5
140172
passed: true
141-
comment: Budget allocation scenario is highly realistic and relatable
173+
comment: FY2026 corporate budget $100M across Engineering/Sales/Marketing/Operations/R&D/G&A
174+
— neutral and realistic.
142175
- id: DQ-03
143176
name: Appropriate Scale
144-
score: 5
145-
max: 5
177+
score: 4
178+
max: 4
146179
passed: true
147-
comment: Values sum to 100 (representing $100M), percentages are plausible
180+
comment: $100M total realistic; allocations sum to 100% with plausible proportions
181+
for engineering-heavy company.
148182
code_quality:
149183
score: 10
150184
max: 10
@@ -154,41 +188,61 @@ review:
154188
score: 3
155189
max: 3
156190
passed: true
157-
comment: 'Clean flat structure: imports → data → plot → save'
191+
comment: 'Linear flow: env read → data → chartannotations → layout → save.'
158192
- id: CQ-02
159193
name: Reproducibility
160-
score: 3
161-
max: 3
194+
score: 2
195+
max: 2
162196
passed: true
163-
comment: Uses deterministic hardcoded data
197+
comment: Fully deterministic hardcoded data; no random generation needed.
164198
- id: CQ-03
165199
name: Clean Imports
166200
score: 2
167201
max: 2
168202
passed: true
169-
comment: Only plotly.graph_objects imported
203+
comment: Only plotly.graph_objects and os used.
170204
- id: CQ-04
171-
name: No Deprecated API
172-
score: 1
173-
max: 1
205+
name: Code Elegance
206+
score: 2
207+
max: 2
174208
passed: true
175-
comment: Uses current Plotly API
209+
comment: Clean idiomatic Plotly code; three-level annotation elegantly split
210+
with semantic colors.
176211
- id: CQ-05
177-
name: Output Correct
212+
name: Output & API
178213
score: 1
179214
max: 1
180215
passed: true
181-
comment: Saves as plot.png and plot.html
182-
library_features:
183-
score: 3
184-
max: 5
216+
comment: Saves plot-light.png, plot-dark.png, plot-light.html, plot-dark.html
217+
with current API.
218+
library_mastery:
219+
score: 7
220+
max: 10
185221
items:
186-
- id: LF-01
187-
name: Uses distinctive library features
222+
- id: LM-01
223+
name: Idiomatic Usage
224+
score: 4
225+
max: 5
226+
passed: true
227+
comment: Uses go.Pie with hole, sort=False, insidetextorientation, hovertemplate;
228+
theme via os.getenv. Excellent but not exhaustive of Plotly-specific patterns.
229+
- id: LM-02
230+
name: Distinctive Features
188231
score: 3
189232
max: 5
190233
passed: true
191-
comment: Uses go.Pie with hole parameter, add_annotation for center text,
192-
and HTML export for interactivity. Could have used more Plotly-specific
193-
features like hovertemplate customization.
194-
verdict: APPROVED
234+
comment: Custom hovertemplate with HTML formatting, interactive HTML export,
235+
clockwise direction + rotation=90 — Plotly-specific features well-applied.
236+
verdict: REJECTED
237+
impl_tags:
238+
dependencies: []
239+
techniques:
240+
- annotations
241+
- html-export
242+
- hover-tooltips
243+
patterns:
244+
- explicit-figure
245+
dataprep: []
246+
styling:
247+
- minimal-chrome
248+
- edge-highlighting

0 commit comments

Comments
 (0)