Skip to content

feat(seaborn): implement gauge-basic#9533

Merged
MarkusNeusinger merged 6 commits into
mainfrom
implementation/gauge-basic/seaborn
Jun 30, 2026
Merged

feat(seaborn): implement gauge-basic#9533
MarkusNeusinger merged 6 commits into
mainfrom
implementation/gauge-basic/seaborn

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Implementation: gauge-basic - python/seaborn

Implements the python/seaborn version of gauge-basic.

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

Parent Issue: #857


🤖 impl-generate workflow

github-actions Bot added 2 commits June 30, 2026 21:28
Regen from quality 89. Addressed:
- Change request: switched from sales/business KPI to CPU utilization monitoring
  (thresholds 40/80, zones Normal/Moderate/High, value=83% in alert zone)
- Canvas size: fixed figsize=(6,6) dpi=400 (was 12x12/300dpi=3600px, now 2400x2400)
- Removed bbox_inches="tight" from savefig (seaborn library rule)
- sns.set_theme style: changed from "white" to "ticks" per library prompt
- Added ELEVATED_BG and INK_MUTED chrome tokens
- Path effects: use PAGE_BG foreground stroke (theme-adaptive vs hardcoded #1A1A17)
- Title: added "python ·" to match canonical format
- sys.path fix: removes own directory to prevent matplotlib.py sibling shadowing package
@claude

claude Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): The gauge chart renders on a warm off-white (#FAF8F1) background. A semi-circular arc is divided into three color zones: green (#009E73) for "Normal" (0–40%), amber (#DDCC77) for "Moderate" (40–80%), and matte red (#AE3030) for "High" (80–100%). The needle points to approximately 83%, landing just inside the High/red zone. A bold dark hub dot sits at the pivot. "83%" is displayed in large bold dark text below the gauge centre, with "CPU Utilization" in muted gray below it. Scale endpoints "0" and "100" appear at the arc's left and right ends. Zone labels ("Normal", "Moderate", "High") are rendered in white bold text on the arc with page-bg halos for legibility. The title "gauge-basic · python · seaborn · anyplot.ai" appears at the top in dark text. All text is clearly readable against the light background.

Dark render (plot-dark.png): The same chart renders on near-black (#1A1A17). The three zone colors (green/amber/red) are identical to the light render — only chrome flips. The needle becomes off-white/light, the hub disc turns light, and the title, value text, scale labels, and context label are all rendered in light text. Zone labels remain white with page-bg (now dark) stroke halos — still clearly readable on each arc segment. "83%" and "CPU Utilization" are rendered in light text with good contrast against the near-black background. No dark-on-dark failures detected. All text is clearly readable against the dark background.

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 15 15
Code Quality 10 10
Library Mastery 4 10
Total 87 100

Visual Quality (29/30)

  • VQ-01: Text Legibility (7/8) — All font sizes explicitly set; proportions good in both themes; minor note: "CPU Utilization" at fontsize=9 is small for mobile scaling but it is tertiary context text
  • VQ-02: No Overlap (6/6) — No overlapping text or data elements in either render
  • VQ-03: Element Visibility (6/6) — Arcs, needle, hub, and zone labels all clearly visible and well-proportioned
  • VQ-04: Color Accessibility (2/2) — Semantic zones (green/amber/red) are supplemented with text labels and needle position, providing redundant encoding beyond hue
  • VQ-05: Layout & Canvas (4/4) — Square 2400×2400 canvas appropriate for gauge; canvas gate passed; well-balanced composition
  • VQ-06: Axis Labels & Title (2/2) — Axes off is correct for gauge; "CPU Utilization" context label and min/max scale labels provide sufficient description
  • VQ-07: Palette Compliance (2/2) — Normal zone = #009E73 (Imprint brand green); Moderate = #DDCC77 (amber semantic anchor for caution); High = #AE3030 (matte red semantic anchor for danger); backgrounds #FAF8F1 / #1A1A17; chrome is theme-correct in both renders

Design Excellence (14/20)

  • DE-01: Aesthetic Sophistication (6/8) — Strong design: semantic color zones, intentional visual hierarchy (large value reading → needle → zone colour), two-circle hub detail, theme-adaptive chrome throughout. Clearly above generic defaults.
  • DE-02: Visual Refinement (4/6) — Good refinement: no axes, no grid, no spines, zone boundary divider lines, path effects on arc labels. Slightly lacking in breathing room — the arc fills most of the upper canvas with limited whitespace between gauge and canvas edges.
  • DE-03: Data Storytelling (4/6) — Good visual hierarchy: 83% in the red zone tells an immediate story of a server under stress. The large value reading and needle position together guide the viewer to the correct urgency without any annotation needed.

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Semi-circular speedometer gauge, correct chart type
  • SC-02: Required Features (4/4) — Single value display, range 0–100, color zones with thresholds at 40 and 80, needle indicator, value label — all present
  • SC-03: Data Mapping (3/3) — Value 83 maps correctly to needle angle; thresholds create correct three zones; min/max shown
  • SC-04: Title & Legend (3/3) — Title is "gauge-basic · python · seaborn · anyplot.ai"; no legend needed (zone labels on arc)

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — Demonstrates all gauge features: zone bands, threshold boundaries, needle, value readout, and scale endpoints
  • DQ-02: Realistic Context (5/5) — Production server CPU utilization is a neutral, real-world technology scenario
  • DQ-03: Appropriate Scale (4/4) — 0–100% range is canonical for CPU; 83% high load is plausible; thresholds at 40%/80% match industry norms

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Linear script: imports → data → plot elements → save; no functions or classes
  • CQ-02: Reproducibility (2/2) — All data hardcoded, fully deterministic
  • CQ-03: Clean Imports (2/2) — Every imported symbol is used (os, sys, pe, plt, np, sns, Circle, Wedge)
  • CQ-04: Code Elegance (2/2) — Clean Pythonic code; sys.path fixup has a clear explanatory comment; no fake UI
  • CQ-05: Output & API (1/1) — Saves as plot-{THEME}.png; no deprecated API

Library Mastery (4/10)

  • LM-01: Idiomatic Usage (3/5) — Correctly uses sns.set_theme() with rc dict for theme propagation. However, the entire chart is built from matplotlib patches (Wedge, Circle, ax.plot, ax.text) — seaborn's own plot functions are not used. This is a genuine constraint: seaborn has no native gauge function, but it means idiomatic seaborn usage is limited to the theming layer.
  • LM-02: Distinctive Features (1/5) — The only seaborn-specific element is sns.set_theme(), which is equivalent to plt.rcParams.update() in matplotlib. The chart could be replicated in pure matplotlib with a one-line rcParams call. No seaborn-distinctive plot function, stat inference, or theming shortcut beyond that is used.

Score Caps Applied

  • None applied — DE-01=6 and DE-02=4, neither ≤ 2; all other caps N/A

Strengths

  • Perfect spec compliance: all gauge features (zones, needle, hub, value, scale, context label) implemented correctly
  • Semantic Imprint palette usage: green/amber/red zones map correctly to Imprint colour positions with appropriate semantic reasoning
  • Theme-adaptive chrome is thorough: needle, hub, text colours, and zone-label halos all adapt between light and dark
  • Clean, deterministic code with no functions, no fake interactivity, correct output file naming
  • Strong visual hierarchy: the 83% value in large bold + red needle position creates an immediate, readable story

Weaknesses

  • Library Mastery is low: seaborn is only used for sns.set_theme() (theming), not for any native seaborn plot function. The chart is pure matplotlib under the hood. Consider whether seaborn-specific stat functions (e.g. arc confidence intervals) or annotation helpers could be layered in, or acknowledge this is a matplotlib-built gauge that seaborn styles.
  • DE-02 canvas breathing room: the arc fills most of the upper canvas; a slightly smaller gauge radius or more generous top margin would improve spatial balance.
  • "CPU Utilization" context label at fontsize=9 is very small (tertiary text at this scale) — at 400px mobile scaling this renders near-illegible. Bumping to fontsize=10 or 11 would improve the mobile readout.

Issues Found

  1. LM-02 LOW: seaborn theming only — the entire chart is matplotlib patches
    • Fix: Consider wrapping the gauge with a seaborn-derived background, using sns.despine() explicitly, or layering a seaborn stat element (e.g. a thin KDE or reference bar below the gauge) to legitimately engage seaborn's plot API
  2. DE-02 MODERATE: Slight spatial compression — arc fills most of the canvas height
    • Fix: Reduce radius slightly (e.g. from 0.38 to 0.34) or add more top/bottom margin to give the gauge more breathing room within the square canvas
  3. VQ-01 MINOR: Context label at fontsize=9 may be hard to read at mobile widths
    • Fix: Increase fontsize of "CPU Utilization" label from 9 to 11

AI Feedback for Next Attempt

The gauge implementation is polished and spec-complete. To break 90: (1) Find a way to incorporate a genuine seaborn plot API element — e.g. a seaborn-styled value display bar, KDE reference, or use seaborn's color palette helpers to build the zone colours — to push LM-01 and LM-02 above 3/1. (2) Add 5–10% more canvas breathing room by slightly reducing the arc radius or expanding the subplot margins. (3) Increase the "CPU Utilization" context label to fontsize=11. These three targeted changes could add ~5 points.

Verdict: REJECTED

@github-actions github-actions Bot added quality:87 Quality score 87/100 ai-rejected Quality not OK, triggers update labels Jun 30, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels Jun 30, 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

claude Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): Semi-circular gauge chart on a warm off-white (#FAF8F1) background. Three color-coded arc zones: green (Normal, 0–40%), amber/golden (Moderate, 40–80%), and matte red (High, 80–100%). A black needle points to 83%, landing in the High zone. Black hub dot at center. Bold "83%" displayed prominently below the gauge at ~fontsize=32, with "CPU Utilization" subtitle beneath it. Min (0) and max (100) labels flank the gauge endpoints. Zone labels ("Normal", "Moderate", "High") appear in white with page-background path-effect halos on the arc. A seaborn sparkline at the bottom shows 10-minute CPU history with threshold reference lines at 40% and 80%. Title "gauge-basic · python · seaborn · anyplot.ai" at the top in dark ink. All text is readable against the light background.

Dark render (plot-dark.png): Same composition on a warm near-black (#1A1A17) background. Zone colors are identical to light render (green #009E73, amber #DDCC77, red #AE3030 — data colors unchanged, only chrome flips). Needle and hub rendered in light/white tones for theme contrast. "83%" and labels in light text (#F0EFE8). Title in light text, clearly readable. Sparkline uses lighter trace color. Zone labels remain white with dark-themed halos adapting correctly. No dark-on-dark failures detected — all text is readable against the dark background.

Both paragraphs are present. Both renders pass legibility check.

Score: 89/100

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

Visual Quality (29/30)

  • VQ-01: Text Legibility (7/8) — All main gauge elements explicitly sized (value=32pt, zone labels=11pt, title=12pt). Minor deduction: sparkline tick labels at fontsize=6 (~33 source-px) fall below mobile-readable threshold at ~400px display width (~5.5px).
  • VQ-02: No Overlap (6/6) — No overlapping elements in either render.
  • VQ-03: Element Visibility (6/6) — Gauge zones, needle, hub, and sparkline all clearly visible. Bold value display creates strong focal point.
  • VQ-04: Color Accessibility (2/2) — Red/green zones use text labels and positional redundancy; not solely hue-dependent.
  • VQ-05: Layout & Canvas (4/4) — Square 2400×2400 canvas correct for gauge. Good vertical split between gauge and sparkline.
  • VQ-06: Axis Labels & Title (2/2) — "CPU Utilization" describes the metric; min/max endpoints labeled; title correct.
  • VQ-07: Palette Compliance (2/2) — Zone colors are Imprint semantic anchors (#009E73 brand green, #DDCC77 amber, #AE3030 matte red). Background #FAF8F1/#1A1A17. All chrome tokens theme-adaptive. Data colors identical across both renders.

Design Excellence (14/20)

  • DE-01: Aesthetic Sophistication (6/8) — Strong design: semantic Imprint colors with clear intentionality, custom needle/hub composition, path-effect halos on zone labels, sparkline adds genuine data depth. Above configured defaults; falls just short of publication-ready due to plain sparkline presentation.
  • DE-02: Visual Refinement (4/6) — Gauge axis fully hidden (axis off), sparkline spines custom-styled at alpha=0.4, threshold reference lines at low alpha. Good attention to detail; sparkline could be further polished.
  • DE-03: Data Storytelling (4/6) — Clear story: "Server CPU is critically high at 83%, trending upward over the past 10 minutes." Sparkline reinforces the urgency narrative. Visual hierarchy guides viewer from large bold value → needle in red zone → rising trend line.

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct semi-circular gauge chart.
  • SC-02: Required Features (4/4) — All spec features present: value display, min/max range, color zones with thresholds, needle indicator, prominent value label.
  • SC-03: Data Mapping (3/3) — 83% correctly placed at ~83% of the 180° arc. Min/max endpoints correctly shown.
  • SC-04: Title & Legend (3/3) — Title is "gauge-basic · python · seaborn · anyplot.ai". No legend needed; zones labeled directly.

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — Shows all gauge aspects: value, zones, thresholds, needle, endpoints. Sparkline adds temporal feature coverage.
  • DQ-02: Realistic Context (5/5) — Production server CPU utilization is a canonical gauge use case, neutral and realistic.
  • DQ-03: Appropriate Scale (4/4) — 83% CPU on 0–100 scale appropriate. Thresholds at 40%/80% are standard sysadmin conventions. Sparkline values (68–86%) plausible for an escalating load scenario.

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Linear flow: imports → chrome tokens → data → gauge rendering → sparkline → save. No functions/classes.
  • CQ-02: Reproducibility (2/2) — Fully deterministic data, no random generation needed.
  • CQ-03: Clean Imports (2/2) — All imports used: pe (path effects on zone labels), plt, np, pd, sns, Circle, Wedge.
  • CQ-04: Code Elegance (2/2) — Clean, well-structured; sys.path fix has explanatory comment; appropriate complexity for the chart type.
  • CQ-05: Output & API (1/1) — Saves as plot-{THEME}.png. No deprecated functions.

Library Mastery (6/10)

  • LM-01: Idiomatic Usage (3/5) — sns.set_theme() with custom rc dict is canonical seaborn theme setup; sns.lineplot() with DataFrame is idiomatic. Main gauge is necessarily matplotlib patches (seaborn has no gauge primitive), limiting idiomatic seaborn scope.
  • LM-02: Distinctive Features (3/5) — Creative hybrid: sns.set_theme() unifies chrome across both axes; sns.lineplot() auto-labels axes from DataFrame column names and integrates cleanly with add_axes() layout. The sparkline-below-gauge composition uses seaborn's matplotlib interoperability in a distinctive way.

Score Caps Applied

  • None — no caps triggered.

Strengths

  • Semantic Imprint color zones (green/amber/red) perfectly aligned with CPU health semantics and explicitly justified in code comments
  • Path effects on zone labels ensure white-text readability over colored arcs in both themes — elegant theme-adaptive solution
  • Seaborn sparkline adds genuine temporal context that tells a compelling story (rising CPU trend into danger zone), going beyond the minimal spec requirement
  • Theme-adaptive chrome applied throughout all elements; both renders pass legibility check with no dark-on-dark failures
  • Perfect spec and data quality — all required features present, realistic scenario, correct Imprint palette

Weaknesses

  • Sparkline tick labels at fontsize=6 are below mobile-readable threshold (~5.5 source-px at 400px display width) — increase to fontsize=8 for and
  • Sparkline Y-axis label is lowercase "cpu" (auto-generated from DataFrame column name) — add explicit for polish

Issues Found

  1. VQ-01 MINOR: Sparkline tick labels at fontsize=6 fall below mobile legibility threshold (~5.5px at 400px width). Fix: change to in and calls on .
  2. LM INHERENT: The seaborn contribution is necessarily limited to the sparkline and theme setup — the gauge itself requires matplotlib patches. This is inherent to the chart type, not a fixable flaw.

AI Feedback for Next Attempt

The implementation is strong overall. Only minor refinements needed: (1) increase sparkline tick label fontsize from 6 to 8 for mobile legibility, (2) add explicit ylabel to sparkline ("CPU %") instead of relying on the auto-generated "cpu" column name. The semantic color choices, path effects, and sparkline narrative are all excellent — preserve them.

Verdict: APPROVED

@github-actions github-actions Bot added quality:89 Quality score 89/100 ai-approved Quality OK, ready for merge and removed quality:87 Quality score 87/100 labels Jun 30, 2026
@MarkusNeusinger MarkusNeusinger merged commit da1f463 into main Jun 30, 2026
@MarkusNeusinger MarkusNeusinger deleted the implementation/gauge-basic/seaborn branch June 30, 2026 21:51
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:89 Quality score 89/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant