Skip to content

feat(pygal): implement scatter-marginal#6129

Merged
MarkusNeusinger merged 4 commits intomainfrom
implementation/scatter-marginal/pygal
May 9, 2026
Merged

feat(pygal): implement scatter-marginal#6129
MarkusNeusinger merged 4 commits intomainfrom
implementation/scatter-marginal/pygal

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

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

Implementation: scatter-marginal - python/pygal

Implements the python/pygal version of scatter-marginal.

File: plots/scatter-marginal/implementations/python/pygal.py

Parent Issue: #2005


🤖 impl-generate workflow

github-actions Bot added 2 commits May 9, 2026 05:28
Regen from quality 88. Addressed:
- theme-adaptive colors (light/dark backgrounds and text)
- Okabe-Ito palette compliance (first series #009E73)
- proper output filenames (plot-{THEME}.png/html)
- color tokens from default-style-guide
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 9, 2026

AI Review - Attempt 1/3

Image Description

Light render (): The plot features a warm off-white background (#FAF8F1) with a composite scatter-marginal layout. The central scatter plot displays 150 teal (#009E73) data points showing positive correlation between Measurement A (x-axis, ~10-90 range) and Measurement B (y-axis, ~10-110 range). The top histogram shows the X distribution with subtle gray bars, and the right histogram shows the Y distribution, both properly aligned with the main scatter axes. All text is rendered in dark colors (INK, INK_SOFT, INK_MUTED) and is clearly readable. The grid is subtle with good contrast. A summary statistics box in the top-right corner displays n=150, r=0.556, and mean values with rounded corners and elevated background. Legibility verdict: PASS — all title, axis labels, tick labels, and annotations are crisp and readable against the light surface.

Dark render (): The plot maintains an identical data layout on a warm near-black background (#1A1A17). The scatter data points remain teal (#009E73) — identical to the light render, confirming theme-invariant data colors. All text is rendered in light colors (INK light = #F0EFE8, INK_SOFT dark = #B8B7B0) and is clearly visible against the dark background. The marginal histograms use theme-adapted gray tones. The summary box has an appropriate elevated background (#242420) with light text. Grid lines are visible and subtle. No dark-on-dark issues present; all chrome elements adapt correctly to the dark theme. Legibility verdict: PASS — all text is readable, no contrast failures, proper theme chrome throughout.

Score: 90/100

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

Visual Quality (30/30)

  • VQ-01: Text Legibility (8/8) — All font sizes explicitly set via Style object (title_font_size=48, label_font_size=36, major_label_font_size=32) and ImageDraw (title=60px). Perfect readability in both themes.
  • VQ-02: No Overlap (6/6) — Excellent spacing; no overlapping text elements. Axis labels, tick labels, and summary box all clearly separated.
  • VQ-03: Element Visibility (6/6) — Scatter markers (size=10, opacity=0.65) are perfectly adapted to 150 points. Marginal bars are clearly visible. No overlapping or obscured elements.
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito first series (#009E73) is CVD-safe and accessible. Marginal gray (INK_SOFT) provides good luminance contrast from data color.
  • VQ-05: Layout & Canvas (4/4) — Canvas 4800×2700 (landscape) is optimal. Composite fills 60-70% of canvas with balanced margins (100px left, 80px bottom, 20px top/right). Perfect proportions, nothing cut off.
  • VQ-06: Axis Labels & Title (2/2) — X: "Measurement A (units)", Y: "Measurement B (units)" — both descriptive with units. Main title correct format.
  • VQ-07: Palette Compliance (2/2) — Primary series is #009E73 ✓. Background light=#FAF8F1, dark=#1A1A17 ✓. All text uses theme-adaptive tokens (INK, INK_SOFT, INK_MUTED). Data colors identical across themes, chrome flips correctly. Both renders theme-correct ✓.

Design Excellence (13/20)

  • DE-01: Aesthetic Sophistication (5/8) — Clean, well-organized design with custom Style objects and theme-adaptive colors throughout. Summary statistics box adds context and polish. Professional execution, but color palette is minimal (only brand green + grays). Not exceptional but solidly above defaults.
  • DE-02: Visual Refinement (4/6) — Grid is subtle via foreground_subtle coloring. Whitespace is generous with good margins. Summary box has rounded corners and elevated background, showing attention to detail. Could push refinement further with spine removal or more sophisticated styling.
  • DE-03: Data Storytelling (4/6) — Plot clearly shows correlation AND individual distributions. Summary statistics add context (n, r, means). Visual hierarchy guides viewer: scatter is focal, marginals support the narrative. Insightful data choice demonstrates the scatter-marginal type well.

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct scatter-marginal: main XY scatter in lower-left, top marginal histogram (X), right marginal histogram (Y). All required subtypes present.
  • SC-02: Required Features (4/4) — All spec features present: bivariate scatter (150 points), marginal histograms on both axes, proper alignment, axes show all data.
  • SC-03: Data Mapping (3/3) — X correctly mapped to Measurement A (horizontal), Y to Measurement B (vertical). Axes ranges appropriate with margins. Marginals aligned with main axes.
  • SC-04: Title & Legend (3/3) — Title format "scatter-marginal · pygal · anyplot.ai" correct. No legend (single series, appropriate). Axis labels descriptive.

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — Shows all features: positive correlation visible, X distribution shows realistic complexity, Y distribution similarly varied. Outliers and density patterns visible.
  • DQ-02: Realistic Context (5/5) — Measurement context is neutral and plausible. Correlated bivariate scenario is realistic. No controversial elements.
  • DQ-03: Appropriate Scale (4/4) — Ranges sensible (x10-90, y10-110). Correlation r=0.556 is realistic. Sample n=150 appropriate for visualization. Factually consistent proportions.

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Linear flow: imports → config → data generation → calculations → charts → compositing → save. No unnecessary functions/classes. Clean and readable.
  • CQ-02: Reproducibility (2/2) — np.random.seed(42) set. All data deterministic and reproducible.
  • CQ-03: Clean Imports (2/2) — All imports used: io (BytesIO), os (ANYPLOT_THEME), numpy, pygal, PIL. No extraneous imports.
  • CQ-04: Code Elegance (2/2) — Code is clean, Pythonic, appropriate complexity. No fake functionality or over-engineering. Well-organized with clear variable names.
  • CQ-05: Output & API (1/1) — Saves as plot-{THEME}.png and plot-{THEME}.html. Uses current pygal API.

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) — Correct use of pygal's high-level API (XY, Bar, HorizontalBar chart classes). Proper Style object configuration for theme adaptation. Good parameter usage (margins, opacity, sizing). Uses render_to_png() and render() correctly. Composition via PIL is somewhat outside pygal's native workflow.
  • LM-02: Distinctive Features (3/5) — Creative use of PIL image composition to create composite layout. Custom Style objects with full theme adaptation. Leverages pygal's opacity parameter. However, the PIL composition is somewhat manual/low-level compared to library-native solutions. Good but not leveraging pygal's unique strengths maximally.

Score Caps Applied

  • None — All criteria pass without triggering caps. DE-01 > 2 and DE-02 > 2, so "correct but boring" cap doesn't apply.

Strengths

  • Perfect visual quality: all text readable in both themes, excellent layout balance
  • Flawless spec compliance: scatter-marginal correctly implemented with proper alignment
  • Strong data quality: realistic, plausible, diverse distributions shown
  • Perfect code quality: clean, reproducible, no technical issues
  • Excellent theme adaptation: data colors identical across themes, chrome adapts perfectly
  • Summary statistics add valuable context without cluttering
  • Well-sized for large canvas (4800×2700)

Weaknesses

  • Design could be more sophisticated: color palette minimal (only brand + grays), limited design flourishes
  • Library mastery: PIL composition is somewhat manual; could explore pygal's native composite capabilities more
  • Visual refinement: could remove spines, experiment with more grid styling, or add more visual hierarchy

Issues Found

None that would prevent approval. All auto-reject checks pass, all criteria met at high quality level.

AI Feedback for Next Attempt

Not applicable — this implementation exceeds the first-review threshold of 90 and is approved for merge.

Verdict: APPROVED

@github-actions github-actions Bot added quality:90 Quality score 90/100 ai-approved Quality OK, ready for merge labels May 9, 2026
@MarkusNeusinger MarkusNeusinger merged commit 2198f80 into main May 9, 2026
3 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/scatter-marginal/pygal branch May 9, 2026 05:32
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 quality:90 Quality score 90/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant