Skip to content

feat(seaborn): implement bar-race-animated#7324

Merged
MarkusNeusinger merged 5 commits into
mainfrom
implementation/bar-race-animated/seaborn
May 19, 2026
Merged

feat(seaborn): implement bar-race-animated#7324
MarkusNeusinger merged 5 commits into
mainfrom
implementation/bar-race-animated/seaborn

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: bar-race-animated - python/seaborn

Implements the python/seaborn version of bar-race-animated.

File: plots/bar-race-animated/implementations/python/seaborn.py

Parent Issue: #3653


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 19, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): A 2×3 small-multiples grid on a warm off-white (#FAF8F1) background, showing 6 panels for years 2014, 2016, 2018, 2020, 2022, and 2024. Each panel contains horizontal bars for 6 tech companies (Alpha Corp, Beta Tech, Gamma Systems, Delta Networks, Epsilon Data, Zeta Cloud) sorted by market cap in ascending order. Bars are colored in Okabe-Ito order: green (#009E73) for Alpha Corp, orange-red (#D55E00) for Beta Tech, blue (#0072B2) for Gamma Systems, reddish-purple (#CC79A7) for Delta Networks, amber (#E69F00) for Epsilon Data, and sky blue (#56B4E9) for Zeta Cloud. Dollar value labels appear at the right end of each bar. The main title and year labels are in dark ink on the warm background. All text is readable against the light background; however, axis labels and tick labels are visually small for a high-resolution canvas.

Dark render (plot-dark.png): The identical layout renders on a warm near-black (#1A1A17) background. All text (title, year labels, company names, axis labels, value annotations) is rendered in light ink and is clearly readable against the dark background. No dark-on-dark failure is present. Data colors are identical to the light render — all six bars retain the same Okabe-Ito palette positions. The subtle x-axis grid maintains the warm dark tone. Both renders pass theme readability.

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

Score: 74/100

Category Score Max
Visual Quality 26 30
Design Excellence 9 20
Spec Compliance 15 15
Data Quality 12 15
Code Quality 10 10
Library Mastery 2 10
Total 74 100

Visual Quality (26/30)

  • VQ-01: Text Legibility (5/8) — All font sizes explicitly set but below recommended for 4800x2700px: main title 20pt (needs >=24pt), axis labels 12pt (needs >=20pt), ticks 11pt (needs >=16pt), value annotations 10pt. Readable in renders but undersized for the large canvas.
  • VQ-02: No Overlap (6/6) — No overlapping elements; value labels fit within the 1.24x x-limit in all panels.
  • VQ-03: Element Visibility (6/6) — Bars are clearly sized and visible in all six panels.
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito palette is CVD-safe; adequate luminance separation between series.
  • VQ-05: Layout & Canvas (3/4) — 2x3 grid fills canvas well; minor wasted space at top.
  • VQ-06: Axis Labels & Title (2/2) — X-axis labeled "Market Cap ($ Billion)" with units; Y-axis uses company name labels.
  • VQ-07: Palette Compliance (2/2) — First series (Alpha Corp) uses #009E73, subsequent companies follow Okabe-Ito in canonical order. Backgrounds are correct (#FAF8F1 light / #1A1A17 dark). Data colors identical across both themes.

Design Excellence (9/20)

  • DE-01: Aesthetic Sophistication (4/8) — Clean, well-configured implementation with correct palette, spine removal, and bold year headers. Does not rise above a well-configured library default; no exceptional typography, emphasis, or compositional choices.
  • DE-02: Visual Refinement (3/6) — Top/right spines removed, subtle x-axis grid (alpha=0.10), bar edges match PAGE_BG for definition. Refinement is present but not fully polished.
  • DE-03: Data Storytelling (2/6) — The 2x3 grid shows ranking changes (Beta Tech overtakes Alpha Corp by 2024) but there is no visual emphasis to guide the viewer to this story. No highlighting of leading bars, no annotations, no size variation.

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correctly implements small multiples grid of key time snapshots per spec guidance for static libraries without animation support.
  • SC-02: Required Features (4/4) — Bars sorted by value at each frame, entity labels on Y-axis, visible time indicator (bold year titles), consistent entity colors across all frames.
  • SC-03: Data Mapping (3/3) — Horizontal bars with companies on Y-axis and market cap on X-axis; all six companies visible in each panel.
  • SC-04: Title & Legend (3/3) — Title Tech Company Rankings · bar-race-animated · python · seaborn · anyplot.ai matches the required format. No legend needed.

Data Quality (12/15)

  • DQ-01: Feature Coverage (5/6) — Shows ranking changes across 6 time points; rankings do change (Beta Tech rises to Add workflow diagram for new prototype discovery #1). Growth is monotonic for all companies without dips, missing the "rise and fall" dynamic the spec highlights.
  • DQ-02: Realistic Context (4/5) — Tech company market cap scenario is neutral and plausible; fictional company names are appropriate.
  • DQ-03: Appropriate Scale (3/4) — Values range from $120B (2014) to $1,100B (2024), plausible for large tech companies. All companies show strictly monotonic growth with no realistic market fluctuations.

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Clean linear flow: imports > theme setup > data > plot loop > save. No functions or classes.
  • CQ-02: Reproducibility (2/2) — All data is hardcoded; fully deterministic, no random seed needed.
  • CQ-03: Clean Imports (2/2) — All imports (os, sys, matplotlib, pandas, seaborn) are actually used.
  • CQ-04: Code Elegance (2/2) — Clean iteration over years, strict=True in zip calls, no fake functionality.
  • CQ-05: Output & API (1/1) — Saves as plot-{THEME}.png; no deprecated API usage.

Library Mastery (2/10)

  • LM-01: Idiomatic Usage (1/5) — The implementation uses only sns.set_theme() from seaborn; all bar charts are drawn using matplotlib's ax.barh() directly. No seaborn plot functions (sns.barplot, etc.) are called anywhere. This constitutes minimal library usage.
  • LM-02: Distinctive Features (1/5) — No seaborn-specific plotting features are used. The only seaborn call is theme setup. Could be any matplotlib plot with seaborn removed.

Score Caps Applied

  • None — DE-01=4 (>2) prevents the "correct but boring" cap from triggering.

Strengths

  • Full spec compliance: correct small-multiples approach for a static library, proper time indicator, sorted bars, consistent entity colors
  • Perfect palette implementation: Okabe-Ito in canonical order, correct theme-adaptive chrome in both light and dark renders
  • Clean readable code with KISS structure and no fake functionality
  • Both theme renders pass readability checks with no dark-on-dark failures

Weaknesses

  • No seaborn plot functions used — entire chart drawn with matplotlib's ax.barh(); LM-01 scores 1/5
  • Font sizes substantially below style-guide minimums for 4800x2700px (12pt axis labels vs. 20pt recommended, 11pt ticks vs. 16pt)
  • No visual storytelling: the Beta Tech/Delta Networks rise is invisible to the viewer — no highlighting, annotation, or emphasis on ranking changes
  • All companies grow monotonically; no realistic market fluctuations reduce the dynamic range of the bar race narrative

Issues Found

  1. LM-01 CRITICAL: No seaborn plot functions used — only sns.set_theme() is called. Replace ax.barh() calls with sns.barplot(data=year_data, y='company', x='market_cap', ax=ax, ...) to use idiomatic seaborn.
    • Fix: Use sns.barplot() for bar rendering; pass color list via the palette argument mapped to company order
  2. VQ-01 LOW: Font sizes below recommended minimums for the large canvas. Title 20pt (need >=24pt), axis labels 12pt (need >=20pt), tick labels 11pt (need >=16pt).
    • Fix: Increase suptitle to fontsize=24, year headers to fontsize=22, axis labels to fontsize=18, tick params to labelsize=16, value annotations to fontsize=13
  3. DE-03 LOW: No visual hierarchy or storytelling emphasis on the rankings shift.
    • Fix: Highlight the top-ranked bar in each panel (e.g., slightly taller bar height=0.75 vs 0.55 for others) or add a subtle text annotation in the 2024 panel noting the leadership change

AI Feedback for Next Attempt

Switch bar rendering from matplotlib's ax.barh() to seaborn's sns.barplot(data=year_data, y='company', x='market_cap', ax=ax, palette=[color_map[c] for c in year_data['company']], orient='h') — this is the critical fix for library mastery. Simultaneously increase all font sizes to meet minimums (suptitle >=24pt, axis labels >=18pt, tick labels >=16pt). Add a storytelling touch: highlight the top-ranked bar in each panel with increased height or a subtle border to guide viewers to notice the ranking changes over time. Consider adding a small value fluctuation to one or two companies to better represent real-world market dynamics.

Verdict: REJECTED

@github-actions github-actions Bot added quality:74 Quality score 74/100 ai-rejected Quality not OK, triggers update labels May 19, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels May 19, 2026
Attempt 1/3 - 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
Copy link
Copy Markdown
Contributor

claude Bot commented May 19, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): The plot renders on a warm off-white (#FAF8F1) background. A 2×3 grid of horizontal bar charts shows six time snapshots (2014, 2016, 2018, 2020, 2022, 2024). Each panel is titled in bold dark text with the year. Bars are drawn in the Okabe-Ito palette — Alpha Corp in #009E73 (brand green), Beta Tech in #D55E00 (vermillion), Gamma Systems in #0072B2 (blue), Delta Networks in #CC79A7 (pink/purple), Epsilon Data in #E69F00 (orange), Zeta Cloud in #56B4E9 (sky blue). Value labels ($120B–$1100B) appear to the right of each bar in dark ink, with colored ▲/▼ rank-change badges for significant movers (e.g., Delta Networks shows "$550B ▲2" in the 2020 panel). The main title at top is clearly readable dark text. Axis labels, tick labels, and company name labels on the y-axis are all legible against the light background. Legibility verdict: PASS.

Dark render (plot-dark.png): The same 2×3 grid renders on a warm near-black (#1A1A17) background. The main title flips to light-colored text, year subtitle titles are white/off-white, axis labels and tick labels render in light secondary ink (#B8B7B0). Data bar colors are identical to the light render (Okabe-Ito positions 1–6 stay constant between themes). Value labels and rank-change badges are readable against the dark background. No dark-on-dark text failures observed — chrome elements all adapt correctly. Legibility verdict: PASS.

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 14 15
Code Quality 10 10
Library Mastery 6 10
Total 86 100

Visual Quality (28/30)

  • VQ-01: Text Legibility (7/8) — All font sizes explicitly set (title 24pt, panel titles 20pt, tick/axis labels 16–20pt, value labels 14pt); readable in both themes. Value labels at 14pt are slightly small for the high-DPI canvas but acceptable.
  • VQ-02: No Overlap (5/6) — Labels fit cleanly in all panels; rank badge in the 2020 panel is positioned correctly. Minor crowding in the 6-panel layout but no collisions.
  • VQ-03: Element Visibility (6/6) — All bars clearly distinguishable; distinct Okabe-Ito colors; rank-mover highlighted edges visible.
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito palette is CVD-safe by design.
  • VQ-05: Layout & Canvas (4/4) — 16×9 figsize, tight_layout applied; nothing cut off.
  • VQ-06: Axis Labels & Title (2/2) — X-axis labelled "Market Cap ($ Billion)" with units; main title includes spec-id, library, language, and anyplot.ai.
  • VQ-07: Palette Compliance (2/2) — First entity (Alpha Corp) = #009E73; Okabe-Ito order followed for all 6 entities; backgrounds are #FAF8F1 / #1A1A17; both themes correct.

Design Excellence (13/20)

  • DE-01: Aesthetic Sophistication (5/8) — Rank-change edge highlighting and ▲/▼ badges with entity-colored labels add genuine polish above the defaults. Intentional visual hierarchy per panel (year title bold, bar colors consistent, movers highlighted).
  • DE-02: Visual Refinement (4/6) — Top/right spines removed; x-axis grid at alpha=0.10; explicit spine and tick color tokens. The 6-panel grid is slightly cramped but well-managed with tight_layout.
  • DE-03: Data Storytelling (4/6) — The rank-change badges guide the viewer to notable shifts (e.g., Delta Networks rising 2 spots in 2020). Consistent color identity across panels enables easy entity tracking across time.

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Small multiples of sorted horizontal bar charts is the correct static alternative for a bar race; spec explicitly endorses this approach.
  • SC-02: Required Features (4/4) — Bars sorted by value per frame ✓; entity labels attached to bars ✓; time indicator visible as panel title ✓; entity color consistent across all panels ✓.
  • SC-03: Data Mapping (3/3) — X = market cap, Y = company names; all 6 entities visible in every panel.
  • SC-04: Title & Legend (3/3) — Title format: "Tech Company Rankings · bar-race-animated · python · seaborn · anyplot.ai" — correctly prefixed with descriptive title.

Data Quality (14/15)

  • DQ-01: Feature Coverage (5/6) — Shows sorted rankings, value progression, rank-change indicators, consistent entity colors; 6 snapshots across a decade. Slightly below max because 6 entities is fewer than the spec's recommended 10–20 (the recommendation targets animation; for static small multiples this is workable).
  • DQ-02: Realistic Context (5/5) — Fictional tech company names are neutral; market cap values ($120B–$1100B) are plausible for large-cap tech over 2014–2024.
  • DQ-03: Appropriate Scale (4/4) — Growth trajectories are realistic (corrections, surges, steady risers); no implausible outliers.

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Flat script, no functions or classes.
  • CQ-02: Reproducibility (2/2) — Data is fully hardcoded; deterministic output.
  • CQ-03: Clean Imports (2/2) — Only os, sys, matplotlib, pandas, seaborn; all used.
  • CQ-04: Code Elegance (2/2) — Clear data structure; rank delta computation is concise; no fake UI elements.
  • CQ-05: Output & API (1/1) — Saves as plot-{THEME}.png; uses current seaborn 0.13 API with hue+palette+legend=False.

Library Mastery (6/10)

  • LM-01: Idiomatic Usage (4/5) — sns.barplot() with hue, palette, and order parameters is idiomatic seaborn horizontal bars; sns.set_theme() with rc dict for global theming is correct.
  • LM-02: Distinctive Features (2/5) — Rank-badge and edge-highlighting logic operates at raw matplotlib patch level rather than via any seaborn-specific higher-level feature. The seaborn usage itself is limited to a single barplot call per panel.

Score Caps Applied

  • None

Strengths

  • Perfect spec compliance: small multiples correctly substitutes for animation per seaborn's static-only nature, with all required features (sorted bars, consistent entity colors, visible time indicators)
  • Rank-change highlighting (colored bar edges + ▲/▼ value badges) adds genuine storytelling value beyond a plain bar chart grid
  • Theme adaptation is flawlessly implemented — all chrome tokens (INK, INK_SOFT, PAGE_BG) thread through every text and spine element
  • Fully flat, deterministic, readable code with no unnecessary abstractions

Weaknesses

  • Library mastery score limited: rank-badge and edge-highlighting operate at raw matplotlib ax.patches level rather than leveraging seaborn-specific higher-level capabilities beyond a single barplot() call per panel
  • Value labels at fontsize=14 are slightly undersized for the 4800×2700 px canvas (guideline suggests 16pt for secondary text)
  • 6 entities/6 time points is on the low end; the spec recommends 10–20 entities for the bar race format — adding more entities would better showcase the ranking dynamics

Issues Found

  1. LM-02 LOW: The seaborn contribution is limited to one barplot() call per panel; all the distinctive logic (rank badges, edge highlighting) is raw matplotlib
    • Fix: Could use seaborn FacetGrid or additional seaborn-specific styling patterns, though the current approach is still valid
  2. Value labels fontsize=14: Slightly below the 16pt guideline for secondary text at high DPI
    • Fix: Increase value label fontsize to 16

AI Feedback for Next Attempt

The implementation is solid and fully compliant. To push above 86: increase value label fontsize to 16pt, and consider using seaborn FacetGrid for the small-multiples layout instead of raw plt.subplots() to raise library mastery. Alternatively, use sns.despine() explicitly and leverage seaborn's legend utilities. These are refinements, not correctness issues.

Verdict: APPROVED

@github-actions github-actions Bot added quality:86 Quality score 86/100 ai-approved Quality OK, ready for merge and removed quality:74 Quality score 74/100 labels May 19, 2026
@MarkusNeusinger MarkusNeusinger merged commit b82561d into main May 19, 2026
3 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/bar-race-animated/seaborn branch May 19, 2026 02:17
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:86 Quality score 86/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant