Skip to content

feat(seaborn): implement funnel-basic#5426

Merged
github-actions[bot] merged 5 commits intomainfrom
implementation/funnel-basic/seaborn
Apr 26, 2026
Merged

feat(seaborn): implement funnel-basic#5426
github-actions[bot] merged 5 commits intomainfrom
implementation/funnel-basic/seaborn

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: funnel-basic - python/seaborn

Implements the python/seaborn version of funnel-basic.

File: plots/funnel-basic/implementations/python/seaborn.py

Parent Issue: #789


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 26, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): The plot displays on a warm off-white #FAF8F1 background. Five trapezoidal funnel segments are stacked vertically, narrowing from top (Awareness) to bottom (Purchase), using Okabe-Ito colors in canonical order: #009E73 (teal), #D55E00 (orange), #0072B2 (blue), #CC79A7 (pink), #E69F00 (amber). Stage names appear in dark ink to the left of the funnel (fontsize 20), and white bold value+percentage labels are centered in each segment (fontsize 18), protected by colored path-effect strokes for overflow legibility. Italic conversion-rate annotations (↓60%, ↓67%, ↓50%, ↓50%) appear in muted ink to the right. The title "funnel-basic · seaborn · anyplot.ai" is clearly visible at the top in dark ink. All text is readable against the light background. Minor note: the narrowest "Intent" and "Purchase" segments cause value text to overflow outside the segment borders, relying on the colored stroke for readability on the cream background — this works but is slightly less polished.

Dark render (plot-dark.png): On the #1A1A17 near-black background, the same Okabe-Ito colors are used identically — only chrome flips. Stage names render in light #F0EFE8-range text, clearly visible. The conversion-rate annotations appear in muted gray. The title is white-on-dark and fully legible. The white text inside segments reads much more cleanly in dark mode since the background provides strong contrast. No dark-on-dark failures. All elements are distinctly readable. Both renders pass theme-readability checks.

Score: 83/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 4 10
Total 83 100

Visual Quality (28/30)

  • VQ-01: Text Legibility (7/8) — Title (24pt), stage names (20pt), value labels (18pt), conversion rates (14pt) well-sized. Minor: path-effect overflow on narrowest segments in light mode is functional but not ideal
  • VQ-02: No Overlap (6/6) — Stage names, value labels, and conversion annotations cleanly separated; no collisions
  • VQ-03: Element Visibility (6/6) — All five segments visible including narrowest (Intent, Purchase)
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito palette, CVD-safe, no red-green sole signal
  • VQ-05: Layout & Canvas (3/4) — Funnel well-proportioned; slight empty space at the bottom below the Purchase segment
  • VQ-06: Axis Labels & Title (2/2) — Title matches required format; no traditional axis labels needed for funnel
  • VQ-07: Palette Compliance (2/2) — First stage #009E73, Okabe-Ito order, #FAF8F1 / #1A1A17 backgrounds correct in both themes

Design Excellence (11/20)

  • DE-01: Aesthetic Sophistication (5/8) — Clear design intent: custom Okabe-Ito colors, path effects for text legibility, conversion-rate annotations, clean typography hierarchy
  • DE-02: Visual Refinement (3/6) — Axes hidden (clean), segment gaps add polish; conversion-rate annotations slightly cramped at right edge
  • DE-03: Data Storytelling (3/6) — Funnel shape inherently narrates conversion drop-off; stage-to-stage conversion percentages add analytical layer; no additional emphasis (e.g., highlighting biggest drop-off)

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct funnel chart with trapezoidal segments narrowing top to bottom
  • SC-02: Required Features (4/4) — Ordered stages largest→smallest ✓, distinct colors per stage ✓, value + percentage labels ✓, width proportional to value ✓
  • SC-03: Data Mapping (3/3) — Sales funnel (Awareness→Interest→Consideration→Intent→Purchase), values [1000,600,400,200,100] exactly as specified
  • SC-04: Title & Legend (3/3) — Title "funnel-basic · seaborn · anyplot.ai" ✓; no legend needed (segments are labeled directly)

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — All funnel aspects shown: proportional widths, stage names, absolute values, percentages, conversion rates
  • DQ-02: Realistic Context (5/5) — Sales funnel scenario is real-world, neutral, and plausible
  • DQ-03: Appropriate Scale (4/4) — 1000→100 with realistic conversion rates (50–67%) reflects typical sales pipeline

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — No functions or classes; flat script
  • CQ-02: Reproducibility (2/2) — Fully deterministic hardcoded data
  • CQ-03: Clean Imports (2/2) — All imports used: os, matplotlib.patheffects, matplotlib.pyplot, seaborn, matplotlib.patches.Polygon
  • CQ-04: Code Elegance (2/2) — Appropriate complexity for a custom chart type; clean loop; no fake UI
  • CQ-05: Output & API (1/1) — Saves as plot-{THEME}.png with correct theme token

Library Mastery (4/10)

  • LM-01: Idiomatic Usage (3/5) — Uses sns.set_theme() for theme/chrome setup idiomatically; all actual polygon drawing is raw matplotlib (unavoidable — seaborn has no funnel primitive)
  • LM-02: Distinctive Features (1/5) — Seaborn usage is limited to set_theme() for color tokens; no seaborn plot functions called; the chart is effectively pure matplotlib

Score Caps Applied

  • None

Strengths

  • Perfect spec compliance: all required features (proportional widths, value+percentage labels, conversion rates between stages, correct data) are present
  • Strong theme-adaptive implementation: all chrome tokens (PAGE_BG, INK, INK_SOFT, INK_MUTED) properly applied; dark render fully readable
  • Elegant use of matplotlib path-effects to keep value text legible when overflowing narrow segments
  • Clean, flat code with no unnecessary abstractions

Weaknesses

  • Seaborn usage is minimal — only sns.set_theme() provides seaborn-specific contribution; the chart could leverage seaborn's barplot or barh with inverted/funnel geometry to involve seaborn more substantively
  • The two narrowest segments (Intent, Purchase) have value text overflowing outside the trapezoid onto the background; the path-effect workaround functions but produces a less polished result compared to fitting text inside or adjusting label placement
  • Slight empty canvas at the bottom below the Purchase segment; consider trimming or centering the funnel vertically

Issues Found

  1. LM-02 LOW: Seaborn used only for theme setup — no seaborn plot function called
    • Fix: Consider implementing the funnel approximation using sns.barplot/ax.barh with custom formatting, or at minimum use sns.despine() for spine control
  2. DE-03 MODERATE: No visual emphasis on biggest or most notable drop-off
    • Fix: Consider highlighting the largest drop (Consideration→Intent: 50%) with a slightly different visual treatment

AI Feedback for Next Attempt

The implementation is functionally excellent — correct chart type, all spec features, both themes working perfectly. The main improvement areas are: (1) incorporate at least one seaborn-specific plot function or despine utility rather than relying solely on sns.set_theme(); (2) for the narrow lower segments, consider reducing font size or using a callout line to avoid text overflow onto the background; (3) add subtle emphasis (e.g., bolder stroke, slightly brighter annotation) on the stage with the largest drop-off.

Verdict: APPROVED

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

- Use sns.barplot + sns.despine substantively (LM-02)
- Move value labels outside bars (VQ-01)
- Highlight worst drop-off (DE-03)
- Closing tail under last stage (VQ-05)
@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 1/3

Applied fixes based on AI review feedback.

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


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 26, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): Warm off-white #FAF8F1 background — correct. Title "funnel-basic · seaborn · anyplot.ai" in dark ink at 24pt — clearly readable. Stage names (Awareness, Interest, Consideration, Intent, Purchase) in dark INK at 20pt on the left — all readable. Conversion-rate annotations (↓60%, ↓67%, ↓50%, ↓50%) in INK_MUTED on the right; the worst drop-off annotation (↓50%, Consideration→Intent) rendered bold and in full INK for emphasis. Five trapezoidal segments in Okabe-Ito order: #009E73, #D55E00, #0072B2, #CC79A7, #E69F00. Value+percentage labels positioned to the right of each bar. The Intent bar carries a bold dark edge outline highlighting the worst conversion step. A closing tail gives the funnel a clean pointed tip. All text readable against the light background — PASS.

Dark render (plot-dark.png): Warm near-black #1A1A17 background — correct. Title in near-white #F0EFE8 — clearly readable. Stage names in light INK token — readable. Conversion-rate annotations in muted #A8A79F — visible. No dark-on-dark failures detected anywhere. Data colors are identical to the light render (#009E73, #D55E00, #0072B2, #CC79A7, #E69F00). Value labels in near-white INK provide excellent contrast on the dark surface. The Intent bar edge outline switches to #F0EFE8 — visible as a light edge on dark. All text readable against the dark background — PASS.

Both paragraphs confirmed. Attempt 2 directly addresses Attempt 1's main weaknesses: sns.barplot() is now used (not just sns.set_theme), the worst drop-off is highlighted, and value labels are placed outside bars without path-effect workarounds.

Score: 90/100

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

Visual Quality (28/30)

  • VQ-01: Text Legibility (7/8) — Title 24pt, stage names 20pt, value labels 18pt, worst-conversion annotation 16pt — all explicitly set. Non-emphasized conversion labels at 13pt fall slightly below the 16pt guideline for secondary text but remain legible.
  • VQ-02: No Overlap (6/6) — Stage names, value labels, and conversion annotations cleanly separated across all five stages
  • VQ-03: Element Visibility (6/6) — All five funnel segments clearly visible including the narrow Intent and Purchase stages; closing tail provides a clean bottom tip
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito is CVD-safe; five distinct hues, no red-green sole signal
  • VQ-05: Layout & Canvas (3/4) — Funnel well-centered and proportioned; 16:9 canvas leaves noticeable horizontal whitespace since the funnel is taller than wide
  • VQ-06: Axis Labels & Title (2/2) — Title matches required format; stage names serve as labels
  • VQ-07: Palette Compliance (2/2) — First stage #009E73, Okabe-Ito order through position 5, #FAF8F1/#1A1A17 backgrounds correct in both themes; chrome flips correctly

Design Excellence (15/20)

  • DE-01: Aesthetic Sophistication (6/8) — Strong design clearly above defaults: custom funnel geometry with per-stage Okabe-Ito colors, intentional typography hierarchy, emphasis on worst drop-off via bold annotation + edge outline
  • DE-02: Visual Refinement (5/6) — All spines removed, no grid, x-axis ticks hidden, y-axis tick marks hidden (length=0), clean closing tail — near-perfect refinement. Minor: 16:9 canvas leaves horizontal whitespace for a tall funnel shape.
  • DE-03: Data Storytelling (4/6) — Funnel shape immediately narrates conversion; worst drop-off highlighted with bold+italic annotation and Intent bar edge outline; visual hierarchy guides reader to the Consideration→Intent bottleneck

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct funnel chart with trapezoidal segments narrowing proportionally top to bottom
  • SC-02: Required Features (4/4) — Ordered stages largest→smallest, distinct per-stage colors, value+percentage labels, proportional widths — all present
  • SC-03: Data Mapping (3/3) — Stage names as y-axis labels, values driving bar width, properly decreasing
  • SC-04: Title & Legend (3/3) — Title funnel-basic · seaborn · anyplot.ai correct; stage names serve as labels (no legend needed)

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — Shows all funnel aspects: proportional widths, absolute values, percentage of total, stage-to-stage conversion rates with varying drop-offs
  • DQ-02: Realistic Context (5/5) — Classic marketing funnel (Awareness→Purchase) is a real-world, neutral, widely-recognized business scenario
  • DQ-03: Appropriate Scale (4/4) — 1000→100 with 50–67% conversion rates reflects a typical sales pipeline

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Flat script: imports → tokens → data → theme → plot → labels → save
  • CQ-02: Reproducibility (2/2) — Fully deterministic hardcoded data
  • CQ-03: Clean Imports (2/2) — All imports used: os, matplotlib.pyplot, seaborn, matplotlib.patches.Polygon
  • CQ-04: Code Elegance (2/2) — Appropriate complexity for a custom chart type; loops are clean; comments explain non-obvious geometry; no fake UI
  • CQ-05: Output & API (1/1) — Saves as plot-{THEME}.png with dpi=300, bbox_inches='tight', facecolor=PAGE_BG

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) — Uses seaborn 0.14+ API correctly: hue=stages + palette + legend=False for per-bar coloring, sns.set_theme() for comprehensive chrome configuration, sns.despine() for spine management. Core funnel geometry unavoidably uses matplotlib Polygon patches (no seaborn funnel primitive exists).
  • LM-02: Distinctive Features (3/5) — hue-based per-bar coloring with legend=False is a seaborn-distinctive pattern (not a one-liner in plain matplotlib); sns.set_theme() and sns.despine() are seaborn-specific. Core polygon geometry is matplotlib.

Score Caps Applied

  • None

Strengths

  • Creative use of sns.barplot as a scaffold for a custom funnel silhouette extended with trapezoidal Polygon patches — clever solution for a chart type seaborn doesn't natively support
  • Correct Okabe-Ito palette with first series #009E73, and full theme-adaptive chrome with no dark-on-dark failures in either render
  • Visual storytelling: worst drop-off (Consideration→Intent) highlighted with bold italic conversion annotation and edge outline on the Intent bar — creates a clear focal point
  • Perfect spec compliance: ordered stages, distinct per-stage colors, value+percentage labels on every segment, proportional widths
  • Clean, deterministic flat code using correct seaborn 0.14+ hue/palette/legend=False API throughout

Weaknesses

  • Non-emphasized conversion-rate annotations at 13pt fall below the 16pt guideline for secondary text — raise all conversion labels to 16pt minimum
  • 16:9 landscape canvas leaves noticeable horizontal whitespace; a square canvas (3600×3600) would better suit the funnel's taller-than-wide shape

Issues Found

  1. VQ-01 MINOR: Non-emphasized conversion-rate annotations rendered at fontsize=13 — below the 16pt secondary-text guideline
    • Fix: Change fontsize=13 to fontsize=16 for all conversion annotations (or use 16 for normal, 18 for bold worst)
  2. VQ-05 MINOR: 16:9 canvas (figsize=(16, 9)) leaves horizontal whitespace for a tall funnel
    • Fix: Switch to figsize=(12, 12) or figsize=(10, 12) for better funnel proportions

AI Feedback for Next Attempt

This is a strong attempt-2 that successfully addressed all major weaknesses from attempt-1 (seaborn plot functions now used, worst drop-off highlighted, labels outside bars without path-effect workarounds). Two minor refinements remain: raise all conversion-rate annotation sizes to ≥16pt, and consider a square or portrait canvas to reduce horizontal whitespace. Design and storytelling are both well above median.

Verdict: APPROVED

@github-actions github-actions Bot added quality:90 Quality score 90/100 ai-approved Quality OK, ready for merge labels Apr 26, 2026
@github-actions github-actions Bot merged commit 063cf9c into main Apr 26, 2026
3 checks passed
@github-actions github-actions Bot deleted the implementation/funnel-basic/seaborn branch April 26, 2026 05:57
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:83 Quality score 83/100 quality:90 Quality score 90/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants