Skip to content

feat(plotnine): implement sunburst-basic#5681

Merged
MarkusNeusinger merged 6 commits intomainfrom
implementation/sunburst-basic/plotnine
May 4, 2026
Merged

feat(plotnine): implement sunburst-basic#5681
MarkusNeusinger merged 6 commits intomainfrom
implementation/sunburst-basic/plotnine

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 4, 2026

Implementation: sunburst-basic - python/plotnine

Implements the python/plotnine version of sunburst-basic.

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

Parent Issue: #821


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): The chart displays on a warm off-white #FAF8F1 background. A two-ring sunburst chart visualizes company budget allocation: the inner ring shows four departments (Engineering in teal #009E73, Marketing in vermillion #D55E00, Operations in blue #0072B2, R&D in reddish-purple #CC79A7), and the outer ring shows team-level breakdowns with matching colors at slightly reduced opacity (alpha=0.65). Inner ring labels (Engineering, Marketing, Operations, R&D) are bold, size-15 text in dark ink. Outer ring shows visible labels for larger segments only (DevOps, Backend, Frontend, Digital, Brand, HR, Product — all ≥8% share). The title "sunburst-basic · plotnine · anyplot.ai" appears at the top in dark ink at size-24. A warm off-white ring gap separates the two levels. All text is clearly readable against the light background. No axis labels, grid, or legend (appropriate for this chart type).

Dark render (plot-dark.png): The same chart renders on a near-black #1A1A17 background. Data colors are identical to the light render — Engineering teal, Marketing vermillion, Operations blue, R&D reddish-purple — only the chrome flips. The inner hole matches the dark background. Title text, inner-ring labels (Engineering, Marketing, Operations, R&D), and outer-ring labels are all in light cream/white tones (#F0EFE8), clearly readable against the dark surface. No dark-on-dark failures: all text is light-colored and legible. The ring separator between inner and outer rings uses color=PAGE_BG (#1A1A17), which creates a thin dark border that's slightly less defined than the warm white separator in the light render, but the ring boundary is still distinguishable. Overall legibility is good on the dark theme.

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

Score: 85/100

Category Score Max
Visual Quality 28 30
Design Excellence 11 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 6 10
Total 85 100

Visual Quality (28/30)

  • VQ-01: Text Legibility (6/8) — Sizes explicitly set (title=24pt ✓, L1=15pt ✓, L2=10pt), but outer-ring labels (10pt) fall below the 16pt minimum guideline for readability elements at 3600×3600px
  • VQ-02: No Overlap (6/6) — Labels well-positioned, no collisions
  • VQ-03: Element Visibility (6/6) — Both rings clearly visible, good contrast, segments well-defined
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito CVD-safe palette, good contrast in both themes
  • VQ-05: Layout & Canvas (4/4) — Chart well-centered on square canvas, fills ~70% appropriately
  • VQ-06: Axis Labels & Title (2/2) — Correct title format; no axis labels needed for radial chart
  • VQ-07: Palette Compliance (2/2) — Engineering starts at #009E73 (brand green), Okabe-Ito order followed, #FAF8F1 / #1A1A17 backgrounds correct, theme chrome adapts properly

Design Excellence (11/20)

  • DE-01: Aesthetic Sophistication (5/8) — Above defaults: two-weight typography (bold L1/regular L2), alpha differentiation between rings (0.65 outer), Okabe-Ito palette, ring separator as visual device. Not quite FiveThirtyEight-level polish.
  • DE-02: Visual Refinement (4/6) — No grid, no axes, clean chrome. Ring separators add definition. Dark-mode separator merges slightly with background (thin dark border on dark background). Generous whitespace.
  • DE-03: Data Storytelling (2/6) — Hierarchy is visible and colors group teams by department, but no emphasis draws attention to the largest segment (Engineering at 40%) or key insights. Data is displayed without interpretation.

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct sunburst: hierarchical concentric rings with angles proportional to values
  • SC-02: Required Features (4/4) — Two rings, consistent branch coloring, major-segment labels, clear level separation
  • SC-03: Data Mapping (3/3) — level_1 departments → inner ring, level_2 teams → outer ring, budget values → angles
  • SC-04: Title & Legend (3/3) — Title: sunburst-basic · plotnine · anyplot.ai ✓; no legend needed (labels on segments)

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — Shows both hierarchy levels with varied segment sizes, multiple categories, proportional representation
  • DQ-02: Realistic Context (5/5) — Company annual budget breakdown: neutral business scenario with realistic department/team structure
  • DQ-03: Appropriate Scale (4/4) — $100M total, Engineering $40M > Marketing $25M > Operations $20M > R&D $15M — plausible for a tech company

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Imports → data → polygon computation → plot → save, no functions/classes
  • CQ-02: Reproducibility (2/2) — Fully deterministic data (no random elements)
  • CQ-03: Clean Imports (2/2) — All imports used; sys.path.pop(0) correctly prevents shadowing
  • CQ-04: Code Elegance (2/2) — Complex polygon loop is necessarily so for plotnine sunburst; clean, Pythonic
  • CQ-05: Output & API (1/1) — Saves plot-{THEME}.png correctly

Library Mastery (6/10)

  • LM-01: Idiomatic Usage (4/5) — Strong: geom_polygon + coord_equal + scale_fill_identity is the correct grammar-of-graphics approach to polar shapes; theme() for chrome adaptation
  • LM-02: Distinctive Features (2/5) — coord_equal + polygon arc approach is somewhat library-specific, but this is a workaround for lack of native polar support rather than a showcase of plotnine's strengths

Score Caps Applied

  • None

Strengths

  • Successfully implements a sunburst chart from polygon primitives — a genuinely difficult feat in a grammar-of-graphics library without native radial support
  • Two-weight typography (bold department labels, regular team labels) creates clear visual hierarchy between ring levels
  • Alpha blending (0.65) on outer ring subtly distinguishes hierarchy levels while keeping the color family intact
  • Perfect spec compliance: correct sunburst structure, Okabe-Ito palette starting at #009E73, adaptive theming, clean title format
  • Deterministic data with realistic, neutral business context that naturally fits the hierarchical chart type

Weaknesses

  • Outer-ring (L2) labels are size=10, below the 16pt guideline — increase to ≥14pt for large-canvas readability
  • No data storytelling: the largest segment (Engineering, 40% of budget) has no visual emphasis beyond size; no percentage annotations or callout to guide the viewer's attention
  • Dark-mode ring separator merges with the near-black background (color=PAGE_BG = #1A1A17) — use a slightly lighter separator color in dark mode for better ring definition

Issues Found

  1. VQ-01 LOW: L2 labels (size=10) below 16pt minimum at 3600×3600px
    • Fix: Increase size=10size=14 or size=13 in the outer-ring geom_text; L1 labels from size=15size=16
  2. DE-03 LOW: No visual emphasis or storytelling beyond raw hierarchy display
    • Fix: Add percentage/value labels to the 2-3 largest segments ("{:.0%}".format(budget/total)), or use slightly larger segment borders on the dominant Engineering slice to create a natural focal point
  3. DE-01/DE-02 MODERATE: Dark-mode ring separator thin dark border reduces ring definition
    • Fix: Use a slightly elevated separator color for dark: e.g. color="#2A2A27" or INK_SOFT to make the gap visible without adding noise

AI Feedback for Next Attempt

Increase L2 label size from 10 to ≥14pt (and L1 from 15 to 16pt) to meet the large-canvas readability guideline. Add percentage or dollar-value labels to the 3-4 largest leaf segments so viewers can extract quantitative insight without estimating from angle. For the dark render, use a slightly lighter separator color (e.g. #2A2A27 or INK_SOFT) between ring levels so the ring gap remains visible. These three fixes should push DE-03 from 2 to 4 and VQ-01 from 6 to 8.

Verdict: REJECTED

@github-actions github-actions Bot added quality:85 Quality score 85/100 ai-rejected Quality not OK, triggers update labels May 4, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels May 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 4, 2026

🔧 Repair Attempt 1/4

Applied fixes based on AI review feedback.

Status: Repair completed, re-triggering review...


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): Two-ring sunburst chart on a warm off-white (#FAF8F1) background. The inner ring shows four company departments — Engineering (~40%, teal #009E73), Marketing (~25%, vermillion #D55E00), Operations (~20%, blue #0072B2), and R&D (~15%, reddish-purple #CC79A7) — with bold department names and softer percentage labels centered within each segment. The outer ring (alpha=0.65) shows sub-departments (Frontend, Backend, DevOps, Digital, Brand, HR, Product) with team labels placed at segment midpoints; smaller teams (Events, Finance, Legal, Data Science) are intentionally unlabeled. Okabe-Ito colors follow the canonical order starting with #009E73 for Engineering. Title 'sunburst-basic · plotnine · anyplot.ai' at top in dark ink. All text is readable against the light background — no light-on-light issues. Legibility verdict: PASS.

Dark render (plot-dark.png): Same layout on a warm near-black (#1A1A17) background. Center hole matches the near-black background. Ring separator uses #2E2D2B (slightly lighter than background) creating subtle segment boundaries. Data colors are identical to the light render — Engineering stays #009E73, Marketing stays #D55E00, Operations #0072B2, R&D #CC79A7. Chrome flips correctly: title and labels render in #F0EFE8 (light cream) and #B8B7B0 (light gray for percentages) against the dark surface. All text is readable — no dark-on-dark failures. Legibility verdict: PASS.

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

Score: 87/100

Category Score Max
Visual Quality 29 30
Design Excellence 14 20
Spec Compliance 15 15
Data Quality 14 15
Code Quality 10 10
Library Mastery 5 10
Total 87 100

Visual Quality (29/30)

  • VQ-01: Text Legibility (7/8) — All sizes explicitly set (title=24, labels=16, pct=13); 13pt percentages are slightly small for 3600×3600 canvas
  • VQ-02: No Overlap (6/6) — Threshold-based labeling prevents crowding; all visible labels well-spaced
  • VQ-03: Element Visibility (6/6) — All ring segments clearly visible in both themes; outer ring alpha=0.65 remains vibrant
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito is CVD-safe; good luminance contrast between segment colors
  • VQ-05: Layout & Canvas (4/4) — Square 12×12 at 300dpi = 3600×3600; chart fills canvas well
  • VQ-06: Axis Labels & Title (2/2) — Title format correct; segment labels serve as data annotations
  • VQ-07: Palette Compliance (2/2) — Engineering=#009E73 first ✓; Okabe-Ito order preserved; #FAF8F1 / #1A1A17 backgrounds correct; chrome adapts cleanly

Design Excellence (14/20)

  • DE-01: Aesthetic Sophistication (5/8) — Thoughtful choices: alpha on outer ring, adaptive ring separators, bold/soft text hierarchy, consistent Okabe-Ito branding — above defaults but not publication-ready
  • DE-02: Visual Refinement (5/6) — All grid, axes, spines, ticks removed; theme-adaptive ring separator (#2E2D2B in dark) for subtle segment definition; generous whitespace; clean minimal composition
  • DE-03: Data Storytelling (4/6) — Engineering's dominance is immediately clear (largest segment); alpha differentiates ring hierarchy; bold department names vs. lighter team names create readable visual hierarchy

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct sunburst with concentric rings at correct hierarchy levels
  • SC-02: Required Features (4/4) — Consistent branch colors ✓; threshold-based labeling ✓; clear ring-level separation ✓; inner segments span children ✓
  • SC-03: Data Mapping (3/3) — level_1=departments (inner ring), level_2=teams (outer ring), value=budget angles
  • SC-04: Title & Legend (3/3) — 'sunburst-basic · plotnine · anyplot.ai' ✓; no legend needed (labels embedded)

Data Quality (14/15)

  • DQ-01: Feature Coverage (5/6) — Shows two hierarchy levels with variable segment sizes; 3rd level (optional grandchild) not implemented
  • DQ-02: Realistic Context (5/5) — Company annual budget breakdown by department and team — neutral, plausible business scenario
  • DQ-03: Appropriate Scale (4/4) — Budget values in with realistic proportions; total ~100M plausible for mid-sized company

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Linear: imports → theme tokens → data → polygon construction → plot → save
  • CQ-02: Reproducibility (2/2) — Fully deterministic (hardcoded dict, no randomness)
  • CQ-03: Clean Imports (2/2) — All imports used; sys for path fix, os for getenv, numpy for trig
  • CQ-04: Code Elegance (2/2) — Polygon loops are necessary for manual sunburst in plotnine; no fake UI
  • CQ-05: Output & API (1/1) — Saves as plot-{THEME}.png; current API throughout

Library Mastery (5/10)

  • LM-01: Idiomatic Usage (3/5) — Correct ggplot grammar (geom_polygon + geom_text layers, coord_equal, scale_fill_identity, theme()); sunburst not native so manual polygon construction is necessary — somewhat low-level
  • LM-02: Distinctive Features (2/5) — coord_equal and scale_fill_identity are plotnine-specific, but the core work is manual coordinate math that would look similar in any polygon-capable library

Score Caps Applied

  • None — all caps conditions are clear (VQ-02=6, VQ-03=6, SC-01=5, DQ-02=5, DE-01=5>2, CQ-04=2)

Strengths

  • Perfectly adapted theme-adaptive chrome: both renders pass readability checks with zero dark-on-dark issues
  • Threshold-based outer ring labeling (≥8%) elegantly prevents overcrowding
  • Ring separator adapts to theme (#2E2D2B in dark vs PAGE_BG in light) — subtle and thoughtful
  • Alpha=0.65 on outer ring creates natural visual hierarchy between hierarchy levels
  • Correct Okabe-Ito order starting with #009E73 for the first/dominant series (Engineering)

Weaknesses

  • Percentage labels at size=13 are below the 16pt minimum for tick-level text at 3600×3600 canvas — consider size=15 minimum
  • Library mastery is capped by plotnine's lack of native sunburst support — polygon construction is inherently low-level

Issues Found

  1. VQ-01 MINOR: Percentage labels at 13pt are slightly small for the canvas size
    • Fix: Increase pct label size to at least 15pt
  2. LM-02 LOW: The implementation is using plotnine primarily as a polygon renderer; the distinctive grammar-of-graphics advantage is underutilized because the chart type isn't native to the library

AI Feedback for Next Attempt

This is a strong, well-executed implementation. The main area for improvement is percentage label size (increase from 13 to 15-16pt) and potentially exploring whether any plotnine-specific features (e.g., stat transformations, faceting hints, or more explicit use of the grammar) could be leveraged further.

Verdict: APPROVED

@github-actions github-actions Bot added quality:87 Quality score 87/100 ai-approved Quality OK, ready for merge labels May 4, 2026
@MarkusNeusinger MarkusNeusinger merged commit f80c686 into main May 4, 2026
3 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/sunburst-basic/plotnine branch May 4, 2026 23:10
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 ai-attempt-1 First repair attempt quality:85 Quality score 85/100 quality:87 Quality score 87/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant