Skip to content

feat(plotnine): implement donut-basic#5341

Merged
github-actions[bot] merged 2 commits intomainfrom
implementation/donut-basic/plotnine
Apr 24, 2026
Merged

feat(plotnine): implement donut-basic#5341
github-actions[bot] merged 2 commits intomainfrom
implementation/donut-basic/plotnine

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: donut-basic - python/plotnine

Implements the python/plotnine version of donut-basic.

File: plots/donut-basic/implementations/python/plotnine.py

Parent Issue: #733


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 24, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): Donut chart on a warm off-white #FAF8F1 background. Five annular segments in Okabe-Ito order: Engineering (46.8%, brand green #009E73), Marketing (20.5%, vermillion #D55E00), Operations (15.1%, blue #0072B2), Sales (12.2%, reddish-purple #CC79A7), Support (5.4%, orange #E69F00). Percentage labels in white appear inside each wedge; category names in dark ink appear outside the ring. Center displays "Total budget" in soft gray and "$1,025K" in bold dark ink. Thin background-colored gaps separate wedges cleanly. All text is clearly readable against the light background. Title "Budget by Department · donut-basic · plotnine · anyplot.ai" is dark and legible.

Dark render (plot-dark.png): Same chart on a warm near-black #1A1A17 surface. All five segment colors are identical to the light render — only the chrome flips. Title and category labels appear in light off-white text, clearly readable. Center "Total budget" renders in soft gray, "$1,025K" in bright near-white. Percentage labels inside wedges remain white. No dark-on-dark failures observed — all text is readable against the dark background.

Both paragraphs are required. A review that only describes one render is invalid.

Score: 86/100

Category Score Max
Visual Quality 28 30
Design Excellence 13 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 5 10
Total 86 100

Visual Quality (28/30)

  • VQ-01: Text Legibility (7/8) — All sizes explicitly set; title at 22pt (below 24pt target) and percentage labels at 14pt (below 16pt recommendation)
  • VQ-02: No Overlap (6/6) — No text collisions; category labels well-spaced around ring
  • VQ-03: Element Visibility (5/6) — All segments visible; Support (5.4%) wedge is small but its label fits
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito CVD-safe; white labels on colored segments have good contrast
  • VQ-05: Layout & Canvas (4/4) — Square format appropriate for donut; well-centered, balanced margins
  • VQ-06: Axis Labels & Title (2/2) — Descriptive title, no axes needed for donut
  • VQ-07: Palette Compliance (2/2) — First series #009E73 ✓; Okabe-Ito order ✓; #FAF8F1 light bg ✓; #1A1A17 dark bg ✓; both renders theme-correct ✓

Design Excellence (13/20)

  • DE-01: Aesthetic Sophistication (5/8) — Above default: intentional wedge gaps, two-tier center metric, clear label hierarchy. Not yet publication-level; typography is functional rather than refined.
  • DE-02: Visual Refinement (4/6) — Fully minimal chrome (no axes, no grid, no legend); background-colored wedge edges add crispness. Good refinement above defaults.
  • DE-03: Data Storytelling (4/6) — Center $1,025K total creates a clear focal point; Engineering dominance (46.8%) is immediately obvious as the largest arc. Viewer is guided to both summary and dominant category.

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct donut (ring chart) with hollow center
  • SC-02: Required Features (4/4) — Hollow center ✓, percentage labels on segments ✓, consistent ordering ✓, center summary metric ✓
  • SC-03: Data Mapping (3/3) — Category → segment; value → arc angle; all 5 categories present
  • SC-04: Title & Legend (3/3) — "Budget by Department · donut-basic · plotnine · anyplot.ai" ✓; category labels directly on chart (no separate legend needed)

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — Hollow center, percentage labels, outer category labels, center summary — all spec features shown
  • DQ-02: Realistic Context (5/5) — Annual budget allocation by department; neutral business scenario with plausible proportions
  • DQ-03: Appropriate Scale (4/4) — Values in $K (480, 210, 155, 125, 55) are realistic for departmental budgets; 5 categories within 3–8 spec range

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — No functions or classes; linear data → polygon construction → plot → save
  • CQ-02: Reproducibility (2/2) — Fully deterministic hardcoded data, no random elements
  • CQ-03: Clean Imports (2/2) — All imports used; math (cos/sin/pi), numpy (linspace), all plotnine symbols consumed
  • CQ-04: Code Elegance (2/2) — Clean, Pythonic loop for polygon construction; appropriate complexity for manual ring chart
  • CQ-05: Output & API (1/1) — plot.save(f"plot-{THEME}.png", dpi=300)

Library Mastery (5/10)

  • LM-01: Idiomatic Usage (3/5) — Uses ggplot grammar (aes, geom_, scale_, theme) correctly; however the idiomatic plotnine/ggplot2 approach for donut charts is coord_polar() + geom_bar() — the manual polygon route bypasses the library's natural strengths
  • LM-02: Distinctive Features (2/5) — scale_fill_identity() and coord_fixed(ratio=1) are distinctly ggplot2 idioms; annotate("text", ...) as a layer is also idiomatic. Lacks use of coord_polar or other plotnine-specific grammar features.

Score Caps Applied

  • None

Strengths

  • Perfect spec compliance: all required donut features (hollow center, percentage labels, center metric, consistent ordering) are present and working
  • Correct Okabe-Ito palette with #009E73 as first series; both light and dark themes render correctly with proper background colors and readable chrome
  • Clean minimal composition — no axes, grid, or legend clutter; background-colored wedge gaps add professional separation
  • Realistic, neutral business data context (budget allocation) with plausible proportions and values

Weaknesses

  • Title font slightly under the 24pt target (set to 22pt); percentage labels inside wedges at 14pt are slightly small for a high-resolution 3600×3600px canvas
  • Library Mastery is low: the polygon-based donut bypasses plotnine's grammar of graphics strengths — using coord_polar() + geom_bar() with appropriate xlim would be more idiomatic ggplot2 style
  • Design Excellence is above average but not exceptional: typography could benefit from a weight hierarchy (e.g., bold category names vs. regular percentages) and the center metric could use more visual contrast between the label and value lines

Issues Found

  1. LM-01 DEFAULT: Manual polygon construction used instead of coord_polar() + geom_bar() pattern
    • Fix: Implement donut using geom_bar(stat='identity') + coord_polar('y') + xlim(c(0.5, n+0.5)) for idiomatic plotnine usage
  2. VQ-01 MINOR: Title at 22pt (target 24pt); percentage labels at 14pt (target 16pt)
    • Fix: Raise plot_title to size=24 and percentage geom_text to size=16
  3. DE-01 MODERATE: Typography hierarchy is functional but not refined
    • Fix: Bold the category name labels (fontweight="bold"); increase visual contrast between center label/value

AI Feedback for Next Attempt

Refactor donut using plotnine's idiomatic coord_polar('y') + geom_bar(stat='identity') approach with xlim controlling inner radius — this demonstrates true plotnine grammar-of-graphics mastery. Raise title to 24pt, percentage labels to 16pt. Add fontweight="bold" to category name labels for stronger typography hierarchy. The center metric approach and Okabe-Ito palette are excellent — keep those.

Verdict: REJECTED

@github-actions github-actions Bot added quality:86 Quality score 86/100 ai-approved Quality OK, ready for merge labels Apr 24, 2026
@github-actions github-actions Bot merged commit d99cd08 into main Apr 24, 2026
3 checks passed
@github-actions github-actions Bot deleted the implementation/donut-basic/plotnine branch April 24, 2026 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-approved Quality OK, ready for merge quality:86 Quality score 86/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants