Skip to content

Commit 2674a10

Browse files
chore(pygal): update quality score 81 and review feedback for line-retention-cohort
1 parent 4523f0a commit 2674a10

2 files changed

Lines changed: 83 additions & 74 deletions

File tree

plots/line-retention-cohort/implementations/pygal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
"""pyplots.ai
1+
""" pyplots.ai
22
line-retention-cohort: User Retention Curve by Cohort
33
Library: pygal 3.1.0 | Python 3.14.3
4-
Quality: 80/100 | Created: 2026-03-16
4+
Quality: 81/100 | Created: 2026-03-16
55
"""
66

77
import numpy as np
Lines changed: 81 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
library: pygal
22
specification_id: line-retention-cohort
33
created: '2026-03-16T20:43:49Z'
4-
updated: '2026-03-16T20:48:08Z'
4+
updated: '2026-03-16T20:57:34Z'
55
generated_by: claude-opus-4-5-20251101
66
workflow_run: 23164943848
77
issue: 4572
@@ -10,151 +10,157 @@ library_version: 3.1.0
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/line-retention-cohort/pygal/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-retention-cohort/pygal/plot_thumb.png
1212
preview_html: https://storage.googleapis.com/pyplots-images/plots/line-retention-cohort/pygal/plot.html
13-
quality_score: 80
13+
quality_score: 81
1414
review:
1515
strengths:
16-
- Excellent data quality with realistic retention scenario and improving cohort
17-
trend
18-
- Perfect code quality — clean KISS structure with seed for reproducibility
19-
- Correct title format and legend labels with cohort sizes
20-
- Custom color palette with good accessibility
16+
- Full spec compliance with all required features implemented (cohort labels with
17+
sizes, 20% threshold, opacity gradation)
18+
- Thoughtful visual hierarchy through progressive opacity and stroke width for newer
19+
cohorts
20+
- Clean, well-structured code with good data generation and idiomatic pygal usage
21+
- Good use of pygal-specific features (cubic interpolation, rich data dicts, tooltip
22+
formatting)
2123
weaknesses:
22-
- No visual differentiation between older and newer cohorts (opacity/line thickness)
23-
as suggested by spec
24-
- No reference/threshold line to provide benchmark context
25-
- Lines converge in later weeks without visual emphasis to guide the viewer
26-
- Lower chart area (0-20%) is mostly wasted space
27-
image_description: The plot displays a line chart with 5 cohort curves (Jan–May
28-
2025) on a white background. Each line starts at 100% retention at week 0 and
29-
decays over 12 weeks. Colors used are steel blue (Jan), coral/salmon (Feb), muted
30-
green (Mar), gold/amber (Apr), and muted purple (May). The Y-axis is labeled "Retained
31-
Users (%)" ranging 0–100 with horizontal gridlines every 10%. The X-axis is labeled
32-
"Weeks Since Signup" with values 0–12. The title reads "line-retention-cohort
33-
· pygal · pyplots.ai" at top center. A legend at the bottom shows each cohort
34-
with its sample size (e.g., "Jan 2025 (n=1,245)"). Dots mark each data point on
35-
the lines. Older cohorts (Jan) decay fastest to ~21%, while newer cohorts (May)
36-
retain ~40% by week 12, showing an improvement trend.
24+
- Oldest cohort line (Jan 2025 at 0.45 opacity) is too faint to track easily against
25+
the white background
26+
- The 20% retention threshold dashed line is barely visible — its reddish color
27+
at 0.6 opacity blends into the background
28+
- Lines converge significantly in weeks 7-9, making individual cohort tracking difficult
29+
- Pygal default chart chrome (frame/spines) still visible, limiting visual refinement
30+
image_description: The plot displays a line chart titled "line-retention-cohort
31+
· pygal · pyplots.ai" on a white background. The Y-axis is labeled "Retained Users
32+
(%)" ranging from 0% to 100% in 10% increments with subtle gray horizontal gridlines.
33+
The X-axis is labeled "Weeks Since Signup" from 0 to 12. Five cohort lines (Jan–May
34+
2025) all start at 100% at week 0 and decay downward with cubic interpolation
35+
smoothing. A faint reddish dashed line marks the 20% retention threshold near
36+
the bottom. Colors progress from very faint (Jan 2025, blue at ~0.45 opacity)
37+
to fully opaque (May 2025, purple at 1.0 opacity), with stroke widths increasing
38+
from 2px to 7px for newer cohorts. The legend at the bottom lists "20% Retention
39+
Threshold" and each cohort with sample sizes (e.g., "Jan 2025 (n=1,245)"). The
40+
Jan 2025 cohort drops to ~22% by week 12, while May 2025 stays around 40%.
3741
criteria_checklist:
3842
visual_quality:
39-
score: 26
43+
score: 24
4044
max: 30
4145
items:
4246
- id: VQ-01
4347
name: Text Legibility
4448
score: 7
4549
max: 8
4650
passed: true
47-
comment: All font sizes explicitly set and readable; slightly oversized relative
48-
to library guide but effective
51+
comment: Font sizes explicitly set (72/48/42/40/36), all text readable at
52+
full resolution
4953
- id: VQ-02
5054
name: No Overlap
51-
score: 6
55+
score: 5
5256
max: 6
5357
passed: true
54-
comment: No overlapping text anywhere; legend well-separated from data
58+
comment: No text overlap; lines converge in later weeks but remain distinguishable
5559
- id: VQ-03
5660
name: Element Visibility
57-
score: 5
61+
score: 4
5862
max: 6
59-
passed: true
60-
comment: Lines and dots visible but converge in later weeks making series
61-
harder to distinguish
63+
passed: false
64+
comment: Jan 2025 line at 0.45 opacity is very faint; 20% threshold dashed
65+
line is hard to see
6266
- id: VQ-04
6367
name: Color Accessibility
64-
score: 4
68+
score: 3
6569
max: 4
6670
passed: true
67-
comment: Five distinct hues with good contrast; no pure red-green pairing
71+
comment: Colors are distinguishable but low opacity on older cohorts reduces
72+
contrast
6873
- id: VQ-05
6974
name: Layout & Canvas
70-
score: 2
75+
score: 3
7176
max: 4
7277
passed: true
73-
comment: Decent canvas usage but significant empty space in lower portion
74-
(0-20% range mostly unused)
78+
comment: Good proportions, nothing cut off, legend well-positioned at bottom
7579
- id: VQ-06
7680
name: Axis Labels & Title
7781
score: 2
7882
max: 2
7983
passed: true
80-
comment: Descriptive labels with units on both axes
84+
comment: 'Descriptive labels with units: Retained Users (%) and Weeks Since
85+
Signup'
8186
design_excellence:
82-
score: 10
87+
score: 12
8388
max: 20
8489
items:
8590
- id: DE-01
8691
name: Aesthetic Sophistication
8792
score: 5
8893
max: 8
8994
passed: true
90-
comment: Custom palette, white background, explicit font sizing — above defaults
91-
but not publication-level
95+
comment: Custom palette with opacity gradation, intentional stroke width hierarchy;
96+
above defaults but not publication-ready
9297
- id: DE-02
9398
name: Visual Refinement
9499
score: 3
95100
max: 6
96101
passed: true
97-
comment: Subtle gray grid, X-guides hidden, legend at bottom; some refinement
98-
visible
102+
comment: White background, subtle gridlines, no x-guides; pygal default chrome
103+
still visible
99104
- id: DE-03
100105
name: Data Storytelling
101-
score: 2
106+
score: 4
102107
max: 6
103-
passed: false
104-
comment: Data shows trend but no visual emphasis — identical line weight/opacity,
105-
no reference line
108+
passed: true
109+
comment: Visual hierarchy through opacity and stroke width emphasizes newer
110+
cohorts; threshold provides benchmark context
106111
spec_compliance:
107-
score: 14
112+
score: 15
108113
max: 15
109114
items:
110115
- id: SC-01
111116
name: Plot Type
112117
score: 5
113118
max: 5
114119
passed: true
115-
comment: Correct line chart with multiple cohorts
120+
comment: Correct line chart
116121
- id: SC-02
117122
name: Required Features
118-
score: 3
123+
score: 4
119124
max: 4
120125
passed: true
121-
comment: Missing opacity/thickness differentiation and reference line
126+
comment: 'All spec features present: 100% start, distinct colors, legend with
127+
sizes, gridlines, threshold line, opacity gradation'
122128
- id: SC-03
123129
name: Data Mapping
124130
score: 3
125131
max: 3
126132
passed: true
127-
comment: X = weeks, Y = retention %, cohort = series — all correct
133+
comment: X=weeks since signup, Y=retention percentage, axes show all data
128134
- id: SC-04
129135
name: Title & Legend
130136
score: 3
131137
max: 3
132138
passed: true
133-
comment: Correct title format and legend labels with cohort sizes
139+
comment: Title format correct, legend labels show cohort name and size
134140
data_quality:
135-
score: 14
141+
score: 13
136142
max: 15
137143
items:
138144
- id: DQ-01
139145
name: Feature Coverage
140146
score: 5
141147
max: 6
142148
passed: true
143-
comment: 5 cohorts with different decay rates showing improving retention
144-
trend
149+
comment: Multiple cohorts with different decay rates showing improving retention
150+
over time
145151
- id: DQ-02
146152
name: Realistic Context
147-
score: 5
153+
score: 4
148154
max: 5
149155
passed: true
150-
comment: Realistic product analytics scenario with plausible cohort sizes
156+
comment: Monthly cohorts with realistic sizes (1100-1590) and plausible exponential
157+
decay patterns
151158
- id: DQ-03
152159
name: Appropriate Scale
153160
score: 4
154161
max: 4
155162
passed: true
156-
comment: Retention 5-100%, cohort sizes ~1000-1600, 12-week tracking — all
157-
realistic
163+
comment: 5 cohorts, 13 time periods, realistic retention values
158164
code_quality:
159165
score: 10
160166
max: 10
@@ -164,56 +170,59 @@ review:
164170
score: 3
165171
max: 3
166172
passed: true
167-
comment: Clean importsdatastyle → chart → save structure
173+
comment: 'Flat script: imports, data, style, plot, save'
168174
- id: CQ-02
169175
name: Reproducibility
170176
score: 2
171177
max: 2
172178
passed: true
173-
comment: np.random.seed(42) set
179+
comment: np.random.seed(42)
174180
- id: CQ-03
175181
name: Clean Imports
176182
score: 2
177183
max: 2
178184
passed: true
179-
comment: All imports used
185+
comment: All imports used (numpy, pygal, Style)
180186
- id: CQ-04
181187
name: Code Elegance
182188
score: 2
183189
max: 2
184190
passed: true
185-
comment: Clean, appropriate complexity with realistic decay model
191+
comment: Clean loop with rich data dicts, appropriate complexity
186192
- id: CQ-05
187193
name: Output & API
188194
score: 1
189195
max: 1
190196
passed: true
191-
comment: Saves as plot.png, current API
197+
comment: Saves plot.png, current API
192198
library_mastery:
193-
score: 6
199+
score: 7
194200
max: 10
195201
items:
196202
- id: LM-01
197203
name: Idiomatic Usage
198204
score: 4
199205
max: 5
200206
passed: true
201-
comment: Good use of pygal.Line, Style, legend_at_bottom, truncate_legend,
202-
range
207+
comment: Good use of Style class, value_formatter, interpolate, legend_at_bottom,
208+
truncate_legend, per-series stroke_style
203209
- id: LM-02
204210
name: Distinctive Features
205-
score: 2
211+
score: 3
206212
max: 5
207-
passed: false
208-
comment: Uses truncate_legend=-1 and stroke_style but doesn't leverage pygal's
209-
interactive SVG or other distinctive features
213+
passed: true
214+
comment: 'Uses pygal-specific features: cubic interpolation, tooltip_fancy_mode,
215+
rich data dicts with custom labels, dual HTML+PNG export'
210216
verdict: REJECTED
211217
impl_tags:
212218
dependencies: []
213-
techniques: []
219+
techniques:
220+
- hover-tooltips
221+
- html-export
214222
patterns:
215223
- data-generation
216224
- iteration-over-groups
217225
dataprep: []
218226
styling:
227+
- alpha-blending
219228
- grid-styling

0 commit comments

Comments
 (0)