Skip to content

feat(matplotlib): implement scatter-marginal#6124

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

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

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

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

Implementation: scatter-marginal - python/matplotlib

Implements the python/matplotlib version of scatter-marginal.

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

Parent Issue: #2005


🤖 impl-generate workflow

github-actions Bot added 2 commits May 9, 2026 05:15
Regen from quality 91. Addressed:
- theme support: full light/dark rendering via ANYPLOT_THEME env var
- color accessibility: changed from #306998 to Okabe-Ito brand #009E73
- branding: fixed docstring from "pyplots.ai" to "anyplot.ai"
- axis labels: domain-specific "Feature A"/"Feature B" instead of generic "X Value"/"Y Value"
- marker sizing: reduced from s=120 to s=100 for optimal density visualization
- output format: theme-suffixed filenames (plot-light.png / plot-dark.png)
- styling: full theme-adaptive chrome for all text, grid, spines, background colors
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 9, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): The plot displays a scatter plot with marginal distributions on a warm off-white surface (#FAF8F1). The main scatter plot (lower-left) shows 200 bivariate data points in brand green (#009E73) with alpha 0.65, revealing a positive correlation pattern with visible bimodal structure. The top histogram (25 bins) shows the distribution of Feature A (x-axis, 0-100 range) in the same brand green with alpha 0.5. The right histogram shows Feature B's distribution (y-axis, 0-80 range). All axes are properly labeled (Feature A, Feature B, Count) in dark text (INK color #1A1A17). Tick labels use INK_SOFT (#4A4A44). Grid lines are subtle (alpha 0.10) and visible. The title "scatter-marginal · matplotlib · anyplot.ai" is large and clearly readable (fontsize 24, medium weight). Spines follow the L-shaped convention (left/bottom visible, top/right removed). All text is readable against the light background with good contrast. Legibility verdict: PASS

Dark render (plot-dark.png): The plot displays identical structure and data on a warm near-black surface (#1A1A17). The scatter points, top histogram, and right histogram all use the exact same brand green (#009E73) as the light render, confirming proper color invariance. Chrome elements have been correctly inverted: the title and axis labels are now light-colored (INK #F0EFE8), tick labels use inverted INK_SOFT (#B8B7B0), and the background is dark. Grid lines remain subtle and visible (using inverted alpha logic). No dark-on-dark text failures are present — all labels are light-colored on the dark background. The layout, proportions, and data representation are identical to the light render. Legibility verdict: PASS

Score: 82/100

Category Score Max
Visual Quality 30 30
Design Excellence 8 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 4 10
Total 82 100

Visual Quality (30/30)

  • VQ-01: Text Legibility (8/8) - All text explicitly colored using theme tokens; readable in both light and dark renders at specified sizes
  • VQ-02: No Overlap (6/6) - GridSpec provides clean spatial separation; no text collisions; all histograms properly aligned
  • VQ-03: Element Visibility (6/6) - Scatter points (s=100, alpha 0.65), histogram bars (alpha 0.5) clearly visible; sized appropriately for 200-point dataset
  • VQ-04: Color Accessibility (2/2) - First series uses Okabe-Ito position 1 (#009E73); colorblind-safe palette; no red-green dependency
  • VQ-05: Layout & Canvas (4/4) - 16:9 landscape aspect ratio appropriate for composite plot; generous margins; main plot dominates; nothing cut off
  • VQ-06: Axis Labels & Title (2/2) - Descriptive labels (Feature A, Feature B, Count); title format correct
  • VQ-07: Palette Compliance (2/2) - Data colors constant (#009E73) between themes; backgrounds correct (#FAF8F1 light, #1A1A17 dark); chrome properly theme-adapted

Design Excellence (8/20)

  • DE-01: Aesthetic Sophistication (4/8) - Generic defaults; no custom palette beyond Okabe-Ito brand green; no intentional design hierarchy beyond spec requirements
  • DE-02: Visual Refinement (2/6) - Spines properly removed, grid subtle, whitespace adequate; but minimal customization beyond specification
  • DE-03: Data Storytelling (2/6) - Clear focal point (main scatter); reveals bimodal correlation; but no emphasis techniques or narrative depth beyond the data itself

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Correct scatter plot with marginal distributions; proper positioning (lower-left main with aligned top/right marginals)
  • SC-02: Required Features (4/4) - Bivariate relationship shown; univariate marginal distributions visible (histograms); all spec requirements met
  • SC-03: Data Mapping (3/3) - X/Y correctly mapped; axis ranges show all data; scales are sensible
  • SC-04: Title & Legend (3/3) - Title correct format; no legend needed (single series)

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) - Bivariate scatter shows relationship; marginal distributions complete the picture; all aspects of scatter-marginal covered
  • DQ-02: Realistic Context (5/5) - Bimodal correlated data; realistic pattern (two clusters visible); neutral domain
  • DQ-03: Appropriate Scale (4/4) - Feature A (0-100), Feature B (0-80); scales sensible; correlation ~0.7 visually apparent

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - No functions/classes; direct procedural code; simple and clear
  • CQ-02: Reproducibility (2/2) - np.random.seed(42); deterministic data generation
  • CQ-03: Clean Imports (2/2) - Only necessary imports; all used (os, plt, numpy, GridSpec)
  • CQ-04: Code Elegance (2/2) - Appropriate complexity for composite layout; no fake interactivity
  • CQ-05: Output & API (1/1) - Saves as plot-{THEME}.png; correct DPI/bbox settings; current API

Library Mastery (4/10)

  • LM-01: Idiomatic Usage (3/5) - Proper Axes methods; GridSpec idiomatically used for layout; theme token pattern correct; but straightforward approach
  • LM-02: Distinctive Features (1/5) - GridSpec effectively used; could showcase more matplotlib-specific techniques

Score Caps Applied

  • None - No caps triggered

Strengths

  • Flawless theme adaptation: chrome inverts correctly, data colors remain constant across light/dark renders
  • Excellent spec compliance: all required features implemented with proper positioning
  • Clean architecture: GridSpec provides elegant multi-panel layout with automatic axis alignment
  • Proper typography and sizing: all text readable at specified font sizes in both themes
  • Data quality: bimodal correlated dataset effectively demonstrates the plot type's capability

Weaknesses

  • Design is functionally correct but generic: relies on defaults without distinctive visual choices
  • Limited library showcase: doesn't leverage matplotlib's more advanced features (e.g., custom artist patches, spline fitting, kernel density overlays)
  • No visual hierarchy emphasis: marginal distributions could benefit from visual distinction (e.g., subtle edge contrast, opacity variation)

Issues Found

None that block approval. The implementation meets all specification requirements and quality standards. Design Excellence scores are moderate (8/20) because the implementation prioritizes correctness over sophistication — this is appropriate for a baseline implementation.

AI Feedback for Next Attempt

N/A — Implementation is approved. (For future enhancements: consider adding KDE curves to marginals, custom spline edges on scatter markers, or color-coding by density region for increased design sophistication.)

Verdict: APPROVED

@github-actions github-actions Bot added quality:82 Quality score 82/100 ai-rejected Quality not OK, triggers update labels May 9, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels May 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 9, 2026

🔧 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 9, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): The scatter plot displays 200 points in brand green (#009E73) on a warm off-white background (#FAF8F1), showing a clear positive correlation with bimodal structure in Feature A (~30 and ~60). The top marginal histogram (aligned with x-axis) displays the bimodal distribution with a semi-transparent histogram and KDE curve overlay. The right marginal histogram (aligned with y-axis) shows Feature B's distribution. All text—title, axis labels (Feature A / Feature B), tick labels, and marginal axis labels (Count)—is rendered in dark ink tones and fully readable against the light background. The grid is subtle (alpha=0.10), and the layout is clean with top/right spines removed. All elements are well-spaced with no overlap.

Dark render (plot-dark.png): The same visualization on a warm near-black background (#1A1A17). The data colors are identical to the light render—scatter points and histogram bars remain brand green (#009E73)—confirming proper theme-independence for data. All text (title, labels, ticks) is now rendered in light ink tones (#F0EFE8 for primary, #B8B7B0 for secondary) and remains fully readable against the dark surface. No dark-on-dark failures detected; tick labels and axis labels are light and clear. The grid and chrome have correctly adapted to the dark theme. The layout, margins, and element visibility are identical to the light render.

Score: 89/100

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

Visual Quality (29/30)

  • VQ-01: Text Legibility (8/8) - All font sizes explicitly set (title 24pt, labels 20pt, ticks 16pt); perfectly readable in both themes
  • VQ-02: No Overlap (6/6) - All text fully readable, no overlapping elements
  • VQ-03: Element Visibility (6/6) - Scatter points optimally adapted for 200-point density (s=100, α=0.65); histograms clear
  • VQ-04: Color Accessibility (2/2) - Brand green is colorblind-safe; good contrast on both surfaces
  • VQ-05: Layout & Canvas (4/4) - Perfect proportions, balanced margins, nothing cut off
  • VQ-06: Axis Labels & Title (1/2) - Generic labels (Feature A/B) lack units
  • VQ-07: Palette Compliance (2/2) - First series is #009E73; backgrounds correct (#FAF8F1 light / #1A1A17 dark); both renders theme-correct

Design Excellence (14/20)

  • DE-01: Aesthetic Sophistication (5/8) - Thoughtful color harmony and intentional GridSpec layout, but resembles well-configured defaults rather than publication-ready sophistication
  • DE-02: Visual Refinement (5/6) - Subtle grid (alpha=0.10), spines removed, generous whitespace, edge highlighting on bars; nearly perfect
  • DE-03: Data Storytelling (4/6) - Bimodal structure and positive correlation are visually clear; visual hierarchy exists but could emphasize insights more

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Correct scatter plot with marginal distributions
  • SC-02: Required Features (4/4) - All features present (scatter, top marginal, right marginal, proper alignment)
  • SC-03: Data Mapping (3/3) - X/Y correctly mapped; marginals aligned with axes
  • SC-04: Title & Legend (3/3) - Title format correct; no legend needed for single series

Data Quality (13/15)

  • DQ-01: Feature Coverage (6/6) - Shows all aspects: bimodal univariate distributions + positive bivariate correlation
  • DQ-02: Realistic Context (3/5) - Plausible but generic (Feature A/B labels); no real-world scenario
  • DQ-03: Appropriate Scale (4/4) - Proportional relationships realistic

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Clean imports → data → plot → save
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) ensures determinism
  • CQ-03: Clean Imports (2/2) - All imports used; no extraneous dependencies
  • CQ-04: Code Elegance (2/2) - Pythonic, appropriate complexity, no fake UI
  • CQ-05: Output & API (1/1) - Saves as plot-{THEME}.png

Library Mastery (8/10)

  • LM-01: Idiomatic Usage (5/5) - Expert use of matplotlib (proper Axes methods, GridSpec, spine/grid manipulation)
  • LM-02: Distinctive Features (3/5) - Uses GridSpec for multi-panel layout (distinctive to matplotlib)

Score Caps Applied

  • None

Strengths

  • Excellent theme adaptation: data colors (#009E73) are identical in both renders; chrome (text, grid, background) properly flips between themes with no legibility issues
  • Strong visual hierarchy through layout: GridSpec creates an intuitive multi-panel composition with marginals properly aligned
  • High code quality: clean KISS structure, all imports used, idiomatic matplotlib patterns
  • Perfect specification compliance: all required features present and correctly implemented
  • Refined visual polish: subtle grid, removed spines, generous whitespace, edge highlighting

Weaknesses

  • Generic axis labels lack units (Feature A, Feature B should specify what is being measured)
  • Design Excellence: implementation is well-executed but looks like refined defaults rather than distinctive design; could benefit from custom color harmony or distinctive visual choices
  • Data storytelling could be stronger: while bimodal structure is visible, no visual emphasis or annotation highlights the key insight

Issues Found

None critical. Implementation passes all auto-reject checks and scores well.

AI Feedback for Next Attempt

N/A — This implementation is approved. To reach 90+ on future plots, consider: (1) adding descriptive axis labels with units to boost VQ-06, (2) using bolder design choices (custom palette refinement, intentional hierarchy) for DE-01, and (3) adding subtle visual emphasis (color highlighting, annotations) to guide viewer attention to key insights (DE-03).

Verdict: APPROVED

@github-actions github-actions Bot added quality:89 Quality score 89/100 ai-approved Quality OK, ready for merge and removed quality:82 Quality score 82/100 labels May 9, 2026
@MarkusNeusinger MarkusNeusinger merged commit 026d9b1 into main May 9, 2026
3 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/scatter-marginal/matplotlib branch May 9, 2026 05:25
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