Skip to content

Commit b578025

Browse files
feat(seaborn): implement scatter-marginal (#6125)
## Implementation: `scatter-marginal` - python/seaborn Implements the **python/seaborn** version of `scatter-marginal`. **File:** `plots/scatter-marginal/implementations/python/seaborn.py` **Parent Issue:** #2005 --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/anyplot/actions/runs/25592661234)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com>
1 parent 5685fde commit b578025

2 files changed

Lines changed: 169 additions & 132 deletions

File tree

plots/scatter-marginal/implementations/python/seaborn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
""" pyplots.ai
1+
""" anyplot.ai
22
scatter-marginal: Scatter Plot with Marginal Distributions
3-
Library: seaborn 0.13.2 | Python 3.13.11
4-
Quality: 91/100 | Created: 2025-12-26
3+
Library: seaborn 0.13.2 | Python 3.13.13
4+
Quality: 91/100 | Updated: 2026-05-09
55
"""
66

77
import numpy as np
Lines changed: 166 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,210 +1,247 @@
11
library: seaborn
2+
language: python
23
specification_id: scatter-marginal
34
created: '2025-12-26T14:58:31Z'
4-
updated: '2025-12-26T15:00:50Z'
5-
generated_by: claude-opus-4-5-20251101
6-
workflow_run: 20524415653
7-
issue: 0
8-
python_version: 3.13.11
5+
updated: '2026-05-09T05:30:01Z'
6+
generated_by: claude-haiku
7+
workflow_run: 25592661234
8+
issue: 2005
9+
python_version: 3.13.13
910
library_version: 0.13.2
10-
preview_url: https://storage.googleapis.com/anyplot-images/plots/scatter-marginal/seaborn/plot.png
11-
preview_html: null
11+
preview_url_light: https://storage.googleapis.com/anyplot-images/plots/scatter-marginal/python/seaborn/plot-light.png
12+
preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/scatter-marginal/python/seaborn/plot-dark.png
13+
preview_html_light: null
14+
preview_html_dark: null
1215
quality_score: 91
13-
impl_tags:
14-
dependencies: []
15-
techniques:
16-
- layer-composition
17-
patterns:
18-
- data-generation
19-
dataprep: []
20-
styling:
21-
- alpha-blending
2216
review:
2317
strengths:
24-
- Excellent use of seaborn jointplot for this plot type, which is specifically designed
25-
for scatter plots with marginal distributions
26-
- Good visual balance with appropriate font sizes using sns.set_context(talk, font_scale=1.4)
27-
- Effective combination of histograms and KDE curves in marginal plots as suggested
28-
by the spec
29-
- Appropriate transparency (alpha=0.65) and marker size for 200 data points with
30-
white edge for visibility
31-
- Correct title format following pyplots.ai conventions
18+
- Correct plot type with proper layout (scatter + marginal histograms + KDE curves)
19+
- 'Excellent visual quality: readable in both light and dark themes, no overlapping
20+
elements'
21+
- Idiomatic use of seaborn's jointplot API with thoughtful customization (alpha,
22+
KDE, grid styling)
23+
- 'Strong data storytelling: correlated Temperature-IceCreamSales data clearly shows
24+
positive relationship'
25+
- 'Perfect specification compliance: correct title format, proper data mapping,
26+
all required features present'
27+
- Clean code structure with reproducible random seed
3228
weaknesses:
33-
- Axis labels are generic (X Value, Y Value) instead of domain-specific labels with
34-
units
35-
- Data scenario is generic rather than representing a real-world use case
36-
- Grid uses dashed style which is slightly more prominent than subtle solid gridlines
37-
image_description: The plot displays a scatter plot with marginal distributions
38-
using seaborn's jointplot. The central scatter plot shows 200 blue points (#306998)
39-
with moderate transparency (alpha 0.65) and white edges. There is a clear positive
40-
correlation visible in the data. The top marginal shows a histogram with ~25 bins
41-
and an overlaid KDE curve for the X variable distribution. The right marginal
42-
shows a horizontal histogram with KDE for the Y variable distribution. Both marginal
43-
histograms use the same blue color with alpha 0.7. The title "scatter-marginal
44-
· seaborn · pyplots.ai" appears at the top. Axis labels show "X Value" and "Y
45-
Value" with a subtle dashed grid. The overall layout is square (~1:1 aspect ratio)
46-
which is appropriate for jointplots.
29+
- 'CQ-05: Code saves to bare ''plot.png'' instead of theme-specific ''plot-{THEME}.png'';
30+
no ANYPLOT_THEME environment variable checking in the code (output is correct
31+
via pipeline wrapper, but code itself is missing theme-adaptive implementation)'
32+
- 'VQ-01: Font sizes are adequate but could be slightly larger for the 4800x2700px
33+
canvas for even better prominence'
34+
- 'DE-01: Design is sophisticated but fairly standard seaborn jointplot styling
35+
- could use more intentional aesthetic choices (custom palette beyond defaults,
36+
unique visual hierarchy)'
37+
image_description: |-
38+
Light render (plot-light.png):
39+
Background: Warm off-white (#FAF8F1) - correct
40+
Chrome: Title "scatter-marginal · seaborn · anyplot.ai" is clearly visible in dark text. Axis labels "Temperature (°C)" and "Ice Cream Sales ($)" are readable and descriptive. Tick labels are well-sized and contrast well against the light background.
41+
Data: Central scatter plot uses teal/green color (#009E73 - Okabe-Ito brand color) with good alpha transparency (0.65) to reveal overlapping points. Top marginal histogram and right marginal histogram show KDE curves overlaid, using matching color with slightly different alpha (0.7). Grid lines are subtle but visible.
42+
Legibility verdict: PASS - all text is clearly readable, no dark-on-light failures
43+
44+
Dark render (plot-dark.png):
45+
Background: Warm near-black (#1A1A17) - correct
46+
Chrome: Title is in light/white text on dark background, clearly visible. Axis labels are light-colored and readable. Tick labels are light and well-defined against the dark background. No dark-on-dark failures detected.
47+
Data: Scatter plot data color is IDENTICAL to light render (#009E73) - excellent. Top and right marginal histograms with KDE curves maintain the same brand green color, showing excellent theme consistency. Grid lines are subtle but visible in both themes. All chrome elements (text, spines, grid) are correctly theme-adapted from the light render.
48+
Legibility verdict: PASS - all text is clearly readable in dark theme, excellent dark-on-light contrast, no theme-adaptation failures
4749
criteria_checklist:
4850
visual_quality:
49-
score: 36
50-
max: 40
51+
score: 29
52+
max: 30
5153
items:
5254
- id: VQ-01
5355
name: Text Legibility
54-
score: 10
55-
max: 10
56+
score: 7
57+
max: 8
5658
passed: true
57-
comment: Title at 26pt, axis labels at 22pt, tick labels at 14-16pt - all
58-
clearly readable
59+
comment: All text readable; font sizes adequate but could be slightly larger
60+
for 4800x2700px canvas
5961
- id: VQ-02
6062
name: No Overlap
61-
score: 8
62-
max: 8
63+
score: 6
64+
max: 6
6365
passed: true
64-
comment: No overlapping text elements, clean layout
66+
comment: No overlapping elements; all text fully readable
6567
- id: VQ-03
6668
name: Element Visibility
67-
score: 7
68-
max: 8
69+
score: 6
70+
max: 6
6971
passed: true
70-
comment: Markers sized appropriately (s=150) for 200 points with good alpha
71-
(0.65). White edge helps distinguish overlapping points. Slightly larger
72-
than optimal per guidelines (100-200 range for 100-300 points).
72+
comment: Markers and KDE curves perfectly adapted to data density with appropriate
73+
alpha
7374
- id: VQ-04
7475
name: Color Accessibility
75-
score: 5
76-
max: 5
76+
score: 2
77+
max: 2
7778
passed: true
78-
comment: Single blue color scheme is colorblind-safe
79+
comment: Okabe-Ito color (#009E73) is colorblind-safe with good contrast in
80+
both themes
7981
- id: VQ-05
80-
name: Layout Balance
82+
name: Layout & Canvas
8183
score: 4
82-
max: 5
84+
max: 4
8385
passed: true
84-
comment: 'Good use of square aspect ratio for jointplot, marginals well-proportioned.
85-
Minor: slight imbalance between marginal sizes due to ratio=5.'
86+
comment: 'Perfect layout: plot fills appropriate canvas area, balanced margins,
87+
central scatter + marginals well-aligned'
8688
- id: VQ-06
87-
name: Axis Labels
88-
score: 1
89+
name: Axis Labels & Title
90+
score: 2
8991
max: 2
9092
passed: true
91-
comment: Descriptive labels "X Value" and "Y Value" but no units provided
93+
comment: Title and labels descriptive with units (Temperature (°C), Ice Cream
94+
Sales ($))
9295
- id: VQ-07
93-
name: Grid & Legend
94-
score: 1
96+
name: Palette Compliance
97+
score: 2
9598
max: 2
9699
passed: true
97-
comment: Grid is subtle (alpha=0.3), but dashed style slightly more prominent
98-
than solid alpha grid. No legend needed for single-color scatter.
100+
comment: 'First series is #009E73; both renders have identical data colors;
101+
backgrounds are theme-correct (#FAF8F1 light, #1A1A17 dark)'
102+
design_excellence:
103+
score: 14
104+
max: 20
105+
items:
106+
- id: DE-01
107+
name: Aesthetic Sophistication
108+
score: 6
109+
max: 8
110+
passed: true
111+
comment: Sophisticated use of jointplot with KDE marginals; above library
112+
defaults but fairly standard implementation without unique visual identity
113+
- id: DE-02
114+
name: Visual Refinement
115+
score: 4
116+
max: 6
117+
passed: true
118+
comment: 'Good refinement: subtle grid (alpha=0.3, dashed), generous whitespace,
119+
KDE curves add polish'
120+
- id: DE-03
121+
name: Data Storytelling
122+
score: 4
123+
max: 6
124+
passed: true
125+
comment: 'Good visual hierarchy: positive correlation clearly evident, marginals
126+
support the main story, good focal point on central scatter'
99127
spec_compliance:
100-
score: 25
101-
max: 25
128+
score: 15
129+
max: 15
102130
items:
103131
- id: SC-01
104132
name: Plot Type
105-
score: 8
106-
max: 8
107-
passed: true
108-
comment: Correct scatter plot with marginal distributions
109-
- id: SC-02
110-
name: Data Mapping
111133
score: 5
112134
max: 5
113135
passed: true
114-
comment: X and Y correctly mapped
115-
- id: SC-03
136+
comment: 'Correct chart type: scatter with marginal histograms and KDE curves'
137+
- id: SC-02
116138
name: Required Features
117-
score: 5
118-
max: 5
139+
score: 4
140+
max: 4
119141
passed: true
120-
comment: Has central scatter, top marginal histogram, right marginal histogram,
121-
both with KDE overlays as spec suggests
122-
- id: SC-04
123-
name: Data Range
142+
comment: 'All features present: main scatter, top marginal histogram+KDE,
143+
right marginal histogram+KDE'
144+
- id: SC-03
145+
name: Data Mapping
124146
score: 3
125147
max: 3
126148
passed: true
127-
comment: All data visible, axes properly scaled
128-
- id: SC-05
129-
name: Legend Accuracy
130-
score: 2
131-
max: 2
132-
passed: true
133-
comment: N/A, no legend needed for this plot type
134-
- id: SC-06
135-
name: Title Format
136-
score: 2
137-
max: 2
149+
comment: X/Y correctly assigned (Temperature/IceCreamSales), all data visible,
150+
axes show full data range
151+
- id: SC-04
152+
name: Title & Legend
153+
score: 3
154+
max: 3
138155
passed: true
139-
comment: 'Uses correct format: "scatter-marginal · seaborn · pyplots.ai"'
156+
comment: 'Title format correct: ''scatter-marginal · seaborn · anyplot.ai'';
157+
no legend needed for single-series'
140158
data_quality:
141-
score: 17
142-
max: 20
159+
score: 15
160+
max: 15
143161
items:
144162
- id: DQ-01
145163
name: Feature Coverage
146164
score: 6
147-
max: 8
165+
max: 6
148166
passed: true
149-
comment: Shows positive correlation and univariate distributions well. Could
150-
show more interesting distribution features (e.g., slight skewness or bimodality).
167+
comment: 'Shows all aspects: scatter plot, bivariate relationship, univariate
168+
marginal distributions'
151169
- id: DQ-02
152170
name: Realistic Context
153-
score: 6
154-
max: 7
171+
score: 5
172+
max: 5
155173
passed: true
156-
comment: Generic "X Value" / "Y Value" labels - plausible but not a specific
157-
real-world scenario
174+
comment: Real, comprehensible, neutral scenario (Temperature vs Ice Cream
175+
Sales correlation)
158176
- id: DQ-03
159177
name: Appropriate Scale
160-
score: 5
161-
max: 5
178+
score: 4
179+
max: 4
162180
passed: true
163-
comment: 'Values in reasonable numeric ranges (X: 10-90, Y: 10-100)'
181+
comment: 'Sensible values: Temperature 10-35°C (realistic seasonal range),
182+
Sales $75-250 (plausible)'
164183
code_quality:
165-
score: 10
184+
score: 9
166185
max: 10
167186
items:
168187
- id: CQ-01
169188
name: KISS Structure
170189
score: 3
171190
max: 3
172191
passed: true
173-
comment: 'Simple linear structure: imports → data → plot → styling → save'
192+
comment: 'Simple, clean code: imports → data generation → plot → save'
174193
- id: CQ-02
175194
name: Reproducibility
176-
score: 3
177-
max: 3
195+
score: 2
196+
max: 2
178197
passed: true
179-
comment: Uses np.random.seed(42)
198+
comment: Uses np.random.seed(42) for deterministic output
180199
- id: CQ-03
181200
name: Clean Imports
182201
score: 2
183202
max: 2
184203
passed: true
185-
comment: Only numpy and seaborn imported, both used
204+
comment: 'Only necessary imports: numpy, seaborn'
186205
- id: CQ-04
187-
name: No Deprecated API
188-
score: 1
189-
max: 1
206+
name: Code Elegance
207+
score: 2
208+
max: 2
190209
passed: true
191-
comment: Uses current seaborn API
210+
comment: Clean, Pythonic, appropriate complexity; no over-engineering or fake
211+
UI
192212
- id: CQ-05
193-
name: Output Correct
194-
score: 1
213+
name: Output & API
214+
score: 0
195215
max: 1
196-
passed: true
197-
comment: Saves as "plot.png"
198-
library_features:
199-
score: 3
200-
max: 5
216+
passed: false
217+
comment: Code saves as 'plot.png' instead of 'plot-{THEME}.png'; lacks ANYPLOT_THEME
218+
environment variable checking (output is correct via pipeline wrapper)
219+
library_mastery:
220+
score: 9
221+
max: 10
201222
items:
202-
- id: LF-01
203-
name: Uses distinctive library features
204-
score: 3
223+
- id: LM-01
224+
name: Idiomatic Usage
225+
score: 5
205226
max: 5
206227
passed: true
207-
comment: Uses seaborn's jointplot which is a distinctive feature. However,
208-
could have used additional seaborn features like hue parameter or different
209-
marginal_kind options (e.g., "kde" or "hist+kde" using marginal_ticks).
228+
comment: Expertly uses seaborn's high-level jointplot API with proper parameterization
229+
(kind, height, ratio, marginal_kws, joint_kws)
230+
- id: LM-02
231+
name: Distinctive Features
232+
score: 4
233+
max: 5
234+
passed: true
235+
comment: Good use of seaborn-specific features (jointplot with KDE marginals);
236+
could explore more creative styling variations
210237
verdict: APPROVED
238+
impl_tags:
239+
dependencies: []
240+
techniques: []
241+
patterns:
242+
- data-generation
243+
dataprep:
244+
- kde
245+
styling:
246+
- alpha-blending
247+
- grid-styling

0 commit comments

Comments
 (0)