Skip to content

feat(makie): implement bar-stacked-percent - #10448

Merged
MarkusNeusinger merged 8 commits into
mainfrom
implementation/bar-stacked-percent/makie
Aug 18, 2026
Merged

feat(makie): implement bar-stacked-percent#10448
MarkusNeusinger merged 8 commits into
mainfrom
implementation/bar-stacked-percent/makie

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Implementation: bar-stacked-percent - julia/makie

Implements the julia/makie version of bar-stacked-percent.

File: plots/bar-stacked-percent/implementations/julia/makie.jl

Parent Issue: #2008


🤖 impl-generate workflow

@claude

claude Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): Warm off-white background (#FAF8F1-consistent). Bold dark title "bar-stacked-percent · julia · makie · anyplot.ai" centered at top, dark y-axis label "Share of Electricity Generation (%)" and x-axis label "Year", soft dark-gray tick labels (0-100% by 20s on Y; 2010/2013/2016/2019/2022/2025 on X). Only bottom+left spines shown (L-shaped frame). Six bars, each stacked into 4 segments summing to 100%: Coal (green #009E73) shrinks 49%→22%, Natural Gas (lavender #C475FD) stays ~flat (27%→22%), Nuclear (blue #4467A3) mildly declines (15%→9%), Renewables (ochre #BD8233) grows 9%→47%. White percentage labels sit centered in each segment ≥6%. Frameless legend at right lists all 4 components. All title/axis/tick text is clearly dark-on-cream and readable; the one caveat is the white labels on the lighter lavender/ochre segments read with lower contrast than on green/blue, though still legible.

Dark render (plot-dark.png): Warm near-black background (#1A1A17-consistent). Identical layout and identical data colors to the light render — only chrome flipped: title/axis/tick text and spines render in light tones against the dark surface, legend text is light-colored. No dark-on-dark failures anywhere; all chrome text is clearly visible. Same minor lavender/ochre percentage-label contrast caveat as light, no theme-adaptation defects otherwise.

Both paragraphs confirmed above; all text is readable in both themes.

Score: 87/100

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

Visual Quality (28/30)

  • VQ-01: Text Legibility (7/8) — all sizes explicitly set, readable both themes, no overflow; title width (~30% of canvas) matches the Makie library prompt's own documented titlesize=20 convention for this title format
  • VQ-02: No Overlap (6/6) — no collisions anywhere
  • VQ-03: Element Visibility (6/6) — bars well-sized, label-skip threshold avoids illegible micro-labels
  • VQ-04: Color Accessibility (1/2) — white percentage labels on lavender/ochre segments have noticeably lower contrast than on green/blue
  • VQ-05: Layout & Canvas (4/4) — balanced margins, legend adjacent to plot, canvas exactly 3200×1800
  • VQ-06: Axis Labels & Title (2/2) — Y-axis has units, X-axis descriptive
  • VQ-07: Palette Compliance (2/2) — Coal=#009E73 first series, canonical order, theme-correct chrome in both renders

Design Excellence (13/20)

  • DE-01: Aesthetic Sophistication (5/8) - Above bare default (conditional inline labels, minimal chrome) but no callout/annotation on the key trend
  • DE-02: Visual Refinement (4/6) - L-shaped spines and frameless legend are good, but zero gridlines make precise cross-bar comparison slightly harder
  • DE-03: Data Storytelling (4/6) - Chronological trend reads clearly, but canonical color order (green=Coal, ochre=Renewables) works against the intuitive green=renewable-energy association

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — correct 100% stacked bar, every bar normalized to 100%
  • SC-02: Required Features (4/4) — distinct colors, clear legend, in-segment percentage labels, consistent component order
  • SC-03: Data Mapping (3/3) — X=year, Y=0-100% share, all data visible
  • SC-04: Title & Legend (3/3) — title format exact, legend labels match components

Data Quality (14/15)

  • DQ-01: Feature Coverage (6/6) — all 4 components across 6 time points, clearly differentiated trajectories
  • DQ-02: Realistic Context (5/5) — real, neutral electricity-generation-mix scenario
  • DQ-03: Appropriate Scale (3/4) — trend direction matches real-world decarbonization patterns; absolute shares are illustrative rather than tied to one specific historical dataset

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3)
  • CQ-02: Reproducibility (2/2) — deterministic hardcoded data, no RNG needed
  • CQ-03: Clean Imports (2/2) — only CairoMakie + Colors, both used
  • CQ-04: Code Elegance (2/2)
  • CQ-05: Output & API (1/1) — save("plot-$(THEME).png", fig; px_per_unit = 2)

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) - Correct high-level Axis/barplot!/Legend usage; manual Legend via PolyElement since barplot! doesn't auto-generate per-stack legend entries
  • LM-02: Distinctive Features (3/5) - Uses barplot!'s native stack keyword (Makie-specific recipe support) instead of manually computing cumulative offsets

Score Caps Applied

  • None

Strengths

  • Correct 100% stacked bar chart — every bar normalized to sum exactly to 100%
  • Inline percentage labels only drawn when a segment is ≥6%, avoiding clutter in thin segments
  • Imprint palette correct: Coal (first series) is #009E73, remaining components follow canonical order
  • Both themes correctly implemented — identical data colors, chrome flips correctly
  • Clean L-shaped spine, no fake interactivity, no edge clipping, canvas exactly 3200×1800
  • Idiomatic Makie usage: native stack keyword on barplot!, custom Legend from PolyElements
  • Deterministic hardcoded data, clean imports, KISS structure

Weaknesses

  • Segment percentage labels use plain white text on the lighter Imprint hues (lavender, ochre), giving noticeably lower contrast than on green/blue — add a thin dark stroke/shadow behind the label text (or switch label color to INK) on the lighter fills only
  • Design Excellence is close to "well-configured default": no callout/annotation marks the chart's clearest insight (e.g. renewables overtaking coal around 2022), and zero grid makes precise cross-bar comparison slightly harder — a subtle y-axis gridline (10-15% opacity) or a direct end-of-series annotation would help
  • Color assignment follows canonical Imprint order (Coal=brand green, Renewables=ochre), which risks a semantic mismatch since readers commonly expect green to signal renewable/clean energy — consider the style guide's semantic-exception path (assign #009E73 to Renewables, reflow the rest) to strengthen the story

Issues Found

  1. VQ-04 LOW: White percentage labels on lavender/ochre segments have ~2.5-3:1 contrast vs ~7:1+ on green/blue segments
    • Fix: Add a subtle dark stroke/shadow behind the label text on the lighter two segments, or switch label color to INK for those segments specifically
  2. DE-01/DE-02 LOW: Solid but fairly standard chart with no annotation and no grid
    • Fix: Add a subtle y-axis gridline (10-15% opacity) and/or a direct callout on the crossover point where renewables overtake coal
  3. DE-03 LOW: Canonical color order assigns brand green to Coal rather than Renewables
    • Fix: Consider reassigning #009E73 to Renewables per the style guide's semantic-exception rule, reflowing the remaining 3 colors across Coal/Natural Gas/Nuclear

AI Feedback for Next Attempt

Improve design excellence: fix the white-on-lavender/ochre label contrast, add a subtle y-axis gridline or a direct callout on the coal/renewables crossover to sharpen the data story, and consider reassigning brand green to Renewables (semantic-exception) instead of Coal to avoid the green="renewable" reader expectation mismatch.

Verdict: REJECTED

@github-actions github-actions Bot added quality:87 Quality score 87/100 ai-rejected Quality not OK, triggers update labels Aug 18, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels Aug 18, 2026
Attempt 1/4 - fixes based on AI review
@github-actions

Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 1/4

Applied fixes based on AI review feedback.

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


🤖 impl-repair

@claude

claude Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): Warm off-white background (#FAF8F1), dark bold title "bar-stacked-percent · julia · makie · anyplot.ai", legible dark axis labels and soft-gray tick labels, subtle single-axis gridlines. Six years (2010-2025) of 100%-stacked bars, four components each. Bottom-to-top segment order in every bar is Coal (green #009E73), Natural Gas (lavender #C475FD), Nuclear (blue #4467A3), Renewables (ochre #BD8233) — i.e. the untouched canonical palette order, NOT the "semantic exception" order (Renewables=green, Coal=ochre) the code's own comments claim to compute. White percentage labels are printed inside every segment; legible on green/blue/lavender, borderline-but-readable on the ochre segment. No crossover annotation/callout is visible anywhere above the bars despite being present in the source. All chrome text is readable against the light background.

Dark render (plot-dark.png): Warm near-black background (#1A1A17), light title/axis/tick text, all clearly legible — no dark-on-dark failures. Data colors and segment ordering are identical to the light render (Coal=green, Natural Gas=lavender, Nuclear=blue, Renewables=ochre), confirming data colors are held constant across themes. Same missing crossover callout as the light render — reproducible across both independently-rendered themes, not a one-off glitch.

Both renders pass basic legibility; the issues below are correctness/fidelity bugs (code vs. rendered output), not readability failures.

Score: 70/100

Category Score Max
Visual Quality 27 30
Design Excellence 11 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 8 10
Library Mastery 6 10
Total (raw) 82 100
Total (capped) 70 100

Visual Quality (27/30)

  • VQ-01: Text Legibility (6/8)
  • VQ-02: No Overlap (6/6)
  • VQ-03: Element Visibility (6/6)
  • VQ-04: Color Accessibility (1/2)
  • VQ-05: Layout & Canvas (4/4)
  • VQ-06: Axis Labels & Title (2/2)
  • VQ-07: Palette Compliance (2/2)

Design Excellence (11/20)

  • DE-01: Aesthetic Sophistication (5/8) - Design intent visible (semantic color reasoning, per-segment label contrast) but the showcase remap never actually renders
  • DE-02: Visual Refinement (4/6) - Spines removed, subtle grid, borderless legend, generous whitespace
  • DE-03: Data Storytelling (2/6) - Intended focal point (crossover callout) never renders; no elevated storytelling beyond default bars

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5)
  • SC-02: Required Features (4/4)
  • SC-03: Data Mapping (3/3)
  • SC-04: Title & Legend (3/3)

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6)
  • DQ-02: Realistic Context (5/5)
  • DQ-03: Appropriate Scale (4/4)

Code Quality (8/10)

  • CQ-01: KISS Structure (3/3)
  • CQ-02: Reproducibility (2/2)
  • CQ-03: Clean Imports (2/2)
  • CQ-04: Code Elegance (0/2) - Two documented "distinctive" features (semantic color remap, crossover callout) are dead code with zero visible effect in either render
  • CQ-05: Output & API (1/1)

Library Mastery (6/10)

  • LM-01: Idiomatic Usage (4/5) - Native stack kwarg on barplot!, proper Axis/Legend construction
  • LM-02: Distinctive Features (2/5) - Native stacking is a genuine strength, but the more distinctive showcase features fail to render

Score Caps Applied

  • CQ-04 = 0 (fake functionality) → Max Score capped at 70. Raw category sum is 82; capped total is 70.

Strengths

  • Uses Makie's native barplot!(...; stack = ...) for true 100%-stacked bars instead of manually cumsum-ing offsets — idiomatic and correctly normalizes each bar to exactly 100%
  • Theme tokens are threaded consistently through Figure, Axis, and Legend — both renders are fully legible with no dark-on-dark or light-on-light failures
  • Clean layout: spines removed, subtle single-axis grid, borderless legend, generous whitespace, correctly formatted title
  • Plausible, neutral real-world data (illustrative electricity generation mix 2010-2025) with a clear compositional trend, 6 categories x 4 components within the spec's recommended range
  • Percentage labels shown for every segment (no share falls below the 6% skip threshold)

Weaknesses

  • Broken "semantic exception" color remap: the code computes source_colors = IMPRINT_PALETTE[[4, 3, 2, 1]], and the accompanying comment explicitly claims Renewables gets brand green (#009E73) and Coal gets ochre. Both rendered PNGs show the opposite — Coal is green, Natural Gas is lavender, Nuclear is blue, Renewables is ochre (the untouched canonical order). The remap has zero visible effect in either theme. Please verify the per-point color vector actually lines up with the stack segments in barplot!, and confirm the shipped PNGs are rendered from the current script (not stale).
  • Missing crossover callout: the lines! + text! pair meant to draw "Renewables overtake Coal" at y=100-106 (after ylims!(ax, 0, 124)) is completely absent from both renders — the axis top sits flush with the 100% bar tops, with no headroom, meaning the explicit ylims! isn't taking effect (likely reset by autolimits triggered by later plotting calls or the Legend). Move ylims! to run last, immediately before save, or otherwise lock the y-range so it survives all subsequent plot/text/legend calls.
  • White percentage-label text on the ochre segment is comparatively low-contrast versus the white-on-green/blue/lavender segments — recheck the label_colors dark/light assignment once the color-remap bug above is fixed, since it's indexed to the intended (not the actually-rendered) segment colors.
  • No Random.seed! call for consistency with the library's reproducibility convention — low priority since the data is a fixed literal matrix and already fully deterministic.

Issues Found

  1. CQ-04 CRITICAL: Two "distinctive" showcase features (semantic color remap, crossover annotation) are present in source and documented in comments, but produce zero visible effect in either rendered PNG
    • Fix: Debug why source_colors doesn't land on the correct stacked segments, and move ylims!(ax, 0, 124) to execute after all plotting/legend calls (right before save) so it isn't overridden by autolimits
  2. DE-03 LOW: No visual hierarchy or storytelling beyond the default stacked bars, since the intended focal-point callout never renders
    • Fix: Once the callout renders correctly, verify it doesn't overlap the legend or clip at the canvas edge

AI Feedback for Next Attempt

The chart's foundations are solid (correct plot type, native Makie stacking, clean theme-adaptive chrome, good data), but two features the code explicitly claims to implement — the semantic-exception color reassignment (Renewables=green, Coal=ochre) and the "Renewables overtake Coal" crossover callout — do not appear in either rendered PNG. Before resubmitting, actually inspect the rendered output (not just the source) after each change: confirm the legend/segment colors match source_colors, and confirm the callout line + text are visible above the 100% bars with room to spare. A ylims! call is only effective if nothing plotted afterward resets the axis's automatic limits — call it last.

Verdict: REJECTED

@github-actions github-actions Bot added quality:70 Quality score 70/100 ai-rejected Quality not OK, triggers update and removed quality:87 Quality score 87/100 labels Aug 18, 2026
@github-actions github-actions Bot added ai-attempt-2 Second repair attempt and removed ai-rejected Quality not OK, triggers update labels Aug 18, 2026
Attempt 2/4 - fixes based on AI review
@github-actions

Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 2/4

Applied fixes based on AI review feedback.

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


🤖 impl-repair

@claude

claude Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

AI Review - Attempt 3/3

Image Description

Light render (plot-light.png): Warm off-white background (#FAF8F1). Bold dark title "bar-stacked-percent · julia · makie · anyplot.ai" centered at top, dark axis labels ("Share of Electricity Generation (%)" / "Year"), soft dark-gray tick labels, subtle single-axis gridlines, only bottom+left spines. Six bars (2010-2025), each stacked into 4 segments summing exactly to 100%: Coal (ochre #BD8233, 49%→22%), Natural Gas (blue #4467A3, 27%→22%), Nuclear (lavender #C475FD, 15%→9%), Renewables (green #009E73, 9%→47%) — brand green is now correctly reassigned to Renewables per the documented semantic-exception rule, and it visibly renders that way. Percentage labels sit centered in every segment with contrast-matched text (dark ink on ochre/lavender, white on blue/green) — all legible. A "Renewables overtake Coal" callout with a connector line sits cleanly above the 2022 bar with no clipping. Frameless legend at right lists all 4 components. All chrome text is clearly dark-on-cream and readable.

Dark render (plot-dark.png): Warm near-black background (#1A1A17). Identical layout and identical data colors to the light render — only chrome flipped: title/axis/tick text, spines, and legend text render in light tones against the dark surface, all clearly legible with no dark-on-dark failures. The crossover callout renders identically positioned, fully visible with correct headroom, matching the light render.

Both renders pass legibility; the two structural defects flagged in attempt 2 (dead color remap, missing callout) are now fixed and confirmed rendering correctly in both themes.

Score: 92/100

Category Score Max
Visual Quality 29 30
Design Excellence 16 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 7 10
Total 92 100

Visual Quality (29/30)

  • VQ-01: Text Legibility (7/8) — all sizes explicit, readable in both themes; smallest labels may shrink at ~400px mobile preview
  • VQ-02: No Overlap (6/6) — no collisions anywhere
  • VQ-03: Element Visibility (6/6) — segment labels skipped below 6% share, avoiding clutter
  • VQ-04: Color Accessibility (2/2) — per-segment label color now matched to background lightness, fixing the attempt-1 contrast complaint
  • VQ-05: Layout & Canvas (4/4) — canvas exactly 3200×1800, balanced margins, callout headroom well-designed
  • VQ-06: Axis Labels & Title (2/2) — Y-axis has units, X-axis descriptive
  • VQ-07: Palette Compliance (2/2) — semantic-exception order (Renewables=#009E73) confirmed rendering correctly in both themes

Design Excellence (16/20)

  • DE-01: Aesthetic Sophistication (6/8) - Semantic color reasoning and crossover callout now both render, showing real design intent beyond bare defaults
  • DE-02: Visual Refinement (5/6) - Spines removed, subtle grid, borderless legend, generous whitespace
  • DE-03: Data Storytelling (5/6) - Crossover callout now renders and correctly marks the narrative focal point

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — correct 100% stacked bar, every bar normalized to 100%
  • SC-02: Required Features (4/4) — distinct colors, clear legend, in-segment percentage labels, consistent order
  • SC-03: Data Mapping (3/3) — X=year, Y=0-100% share, all data visible
  • SC-04: Title & Legend (3/3) — title format exact, legend labels match components

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — all 4 components across 6 time points
  • DQ-02: Realistic Context (5/5) — plausible, neutral electricity-generation-mix scenario
  • DQ-03: Appropriate Scale (4/4) — shares follow a real-world decarbonization pattern

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3)
  • CQ-02: Reproducibility (2/2) — deterministic hardcoded data, no RNG needed
  • CQ-03: Clean Imports (2/2) — CairoMakie + Colors, both used
  • CQ-04: Code Elegance (2/2) — color remap and callout now match rendered output exactly; no dead/fake functionality
  • CQ-05: Output & API (1/1) — save("plot-$(THEME).png", fig; px_per_unit = 2)

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) - Native stack kwarg on barplot!, proper Axis/Legend construction
  • LM-02: Distinctive Features (3/5) - Native stacking, custom PolyElement legend, conditional segment labeling, crossover annotation

Score Caps Applied

  • None

Strengths

  • Semantic-exception color remap now renders correctly (Renewables=green, Coal=ochre, confirmed identical in both themes) — resolves the attempt-2 dead-code defect
  • Crossover callout ("Renewables overtake Coal" at 2022) now renders visibly with correct headroom via ylims! called last, right before save — no clipping, no overlap
  • Per-segment label color matched to actual segment background lightness, giving good contrast on every segment in both themes — resolves the attempt-1 low-contrast complaint
  • Idiomatic native barplot!(...; stack = ...) for true 100%-stacked bars
  • Theme tokens threaded consistently through Figure, Axis, and Legend; both renders fully legible, canvas exactly 3200×1800
  • Clean, refined layout: spines removed, subtle grid, borderless theme-matched legend, generous whitespace
  • Code now matches rendered output exactly — no fake or dead functionality

Weaknesses

  • Segment/tick labels (fontsize 12) will shrink to only a few px at the ~400px mobile preview — consider a slightly larger fontsize floor if mobile feedback comes back negative
  • Aesthetic sophistication is solid but not maximal — one callout and adaptive label color are the only distinctive storytelling devices; an additional touch (e.g. end-of-series value emphasis) could push this further
  • Library Mastery is good but not exhaustive — no use of more advanced Makie-specific recipes beyond native stack= barplot and manual legend

Issues Found

None blocking — both structural defects from attempt 2 (dead color remap, missing callout) are confirmed fixed and rendering correctly.

AI Feedback for Next Attempt

N/A — approved. If revisited, consider deepening Design Excellence/Library Mastery further with an additional distinctive touch (e.g. end-of-series value labels or a more advanced Makie recipe).

Verdict: APPROVED

@github-actions github-actions Bot added quality:92 Quality score 92/100 ai-approved Quality OK, ready for merge and removed quality:70 Quality score 70/100 labels Aug 18, 2026
@MarkusNeusinger
MarkusNeusinger merged commit d27d668 into main Aug 18, 2026
3 checks passed
@MarkusNeusinger
MarkusNeusinger deleted the implementation/bar-stacked-percent/makie branch August 18, 2026 15:46
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 ai-attempt-2 Second repair attempt quality:92 Quality score 92/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant