Skip to content

Commit 2c41aef

Browse files
chore(pygal): update quality score 85 and review feedback for heatmap-cohort-retention
1 parent fd878fb commit 2c41aef

2 files changed

Lines changed: 222 additions & 10 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
"""pyplots.ai
1+
""" pyplots.ai
22
heatmap-cohort-retention: Cohort Retention Heatmap
3-
Library: pygal | Python 3.13
4-
Quality: pending | Created: 2026-03-16
3+
Library: pygal 3.1.0 | Python 3.14.3
4+
Quality: 85/100 | Created: 2026-03-16
55
"""
66

77
import sys
Lines changed: 219 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# Per-library metadata for pygal implementation of heatmap-cohort-retention
2-
# Auto-generated by impl-generate.yml
3-
41
library: pygal
52
specification_id: heatmap-cohort-retention
63
created: '2026-03-16T20:46:42Z'
7-
updated: '2026-03-16T20:46:42Z'
4+
updated: '2026-03-16T20:50:54Z'
85
generated_by: claude-opus-4-5-20251101
96
workflow_run: 23165008448
107
issue: 4570
@@ -13,7 +10,222 @@ library_version: 3.1.0
1310
preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-cohort-retention/pygal/plot.png
1411
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-cohort-retention/pygal/plot_thumb.png
1512
preview_html: https://storage.googleapis.com/pyplots-images/plots/heatmap-cohort-retention/pygal/plot.html
16-
quality_score: null
13+
quality_score: 85
1714
review:
18-
strengths: []
19-
weaknesses: []
15+
strengths:
16+
- Excellent spec compliance — all required features implemented correctly including
17+
triangular shape, cohort sizes, retention percentages in cells, and color bar
18+
- Strong library mastery — properly subclasses pygal Graph class using idiomatic
19+
_plot()/_compute() pattern with native SVG node creation and tooltip system
20+
- Good color design — sequential green colormap with adaptive text contrast ensures
21+
readability across all cells
22+
- Realistic, neutral data — SaaS cohort retention with plausible values and natural
23+
improvement trend
24+
weaknesses:
25+
- Design could be elevated to publication quality — the overall aesthetic is good
26+
but not exceptional; needs more intentional visual hierarchy
27+
- Data storytelling is limited — no visual emphasis on key insights like the retention
28+
improvement trend across cohorts
29+
- Custom class adds complexity that deviates from KISS structure
30+
image_description: 'The plot displays a cohort retention heatmap with a triangular
31+
shape. The title reads "heatmap-cohort-retention · pygal · pyplots.ai" centered
32+
at the top. The y-axis is labeled "Signup Cohort" with monthly labels from Jan
33+
2024 to Oct 2024, each showing cohort sizes (e.g., n=1,200). The x-axis header
34+
reads "Months Since Signup" with columns Month 0 through Month 9. Cells are colored
35+
using a sequential green colormap — dark green for 100% retention, progressively
36+
lighter greens for lower values down to ~26%. Each cell displays its retention
37+
percentage as text (white on dark backgrounds, dark on light backgrounds). The
38+
triangular shape is correctly formed: Jan 2024 has 10 columns, each subsequent
39+
cohort has one fewer. A vertical colorbar on the right side shows "Retention %"
40+
with tick marks from 26% to 100%. White borders separate cells with rounded corners.'
41+
criteria_checklist:
42+
visual_quality:
43+
score: 28
44+
max: 30
45+
items:
46+
- id: VQ-01
47+
name: Text Legibility
48+
score: 7
49+
max: 8
50+
passed: true
51+
comment: Font sizes explicitly set throughout (title 54px, headers ~42px,
52+
row labels ~36px, cell values ~38px). Colorbar labels slightly small at
53+
28px.
54+
- id: VQ-02
55+
name: No Overlap
56+
score: 6
57+
max: 6
58+
passed: true
59+
comment: No overlapping text. Clean cell gaps and spacing.
60+
- id: VQ-03
61+
name: Element Visibility
62+
score: 6
63+
max: 6
64+
passed: true
65+
comment: All cells clearly visible with good sizing, rounded corners, white
66+
borders.
67+
- id: VQ-04
68+
name: Color Accessibility
69+
score: 4
70+
max: 4
71+
passed: true
72+
comment: Sequential green colormap is colorblind-friendly. Text color adapts
73+
to background.
74+
- id: VQ-05
75+
name: Layout & Canvas
76+
score: 3
77+
max: 4
78+
passed: true
79+
comment: Good layout, minor imbalance from empty space in lower-right inherent
80+
to triangular shape.
81+
- id: VQ-06
82+
name: Axis Labels & Title
83+
score: 2
84+
max: 2
85+
passed: true
86+
comment: 'Descriptive axis titles: Months Since Signup and Signup Cohort.'
87+
design_excellence:
88+
score: 12
89+
max: 20
90+
items:
91+
- id: DE-01
92+
name: Aesthetic Sophistication
93+
score: 5
94+
max: 8
95+
passed: true
96+
comment: Custom green colormap, rounded corners, cohort sizes, good typography
97+
hierarchy. Above defaults but not publication-level.
98+
- id: DE-02
99+
name: Visual Refinement
100+
score: 4
101+
max: 6
102+
passed: true
103+
comment: Default axes hidden, cell gaps for breathing room, clean white background.
104+
- id: DE-03
105+
name: Data Storytelling
106+
score: 3
107+
max: 6
108+
passed: false
109+
comment: Triangular shape conveys retention decay. No strong focal point or
110+
highlighted insight.
111+
spec_compliance:
112+
score: 15
113+
max: 15
114+
items:
115+
- id: SC-01
116+
name: Plot Type
117+
score: 5
118+
max: 5
119+
passed: true
120+
comment: Correct triangular cohort retention heatmap.
121+
- id: SC-02
122+
name: Required Features
123+
score: 4
124+
max: 4
125+
passed: true
126+
comment: 'All features present: triangular shape, retention percentages, cohort
127+
sizes, colormap, colorbar.'
128+
- id: SC-03
129+
name: Data Mapping
130+
score: 3
131+
max: 3
132+
passed: true
133+
comment: Cohorts on Y-axis, periods on X-axis. Period 0 always 100%.
134+
- id: SC-04
135+
name: Title & Legend
136+
score: 3
137+
max: 3
138+
passed: true
139+
comment: Correct title format. Colorbar serves as legend.
140+
data_quality:
141+
score: 14
142+
max: 15
143+
items:
144+
- id: DQ-01
145+
name: Feature Coverage
146+
score: 5
147+
max: 6
148+
passed: true
149+
comment: Shows full retention decay, triangular shape, cohort variation, improvement
150+
trend. Could have more dramatic variation.
151+
- id: DQ-02
152+
name: Realistic Context
153+
score: 5
154+
max: 5
155+
passed: true
156+
comment: SaaS monthly cohort retention. Neutral and realistic.
157+
- id: DQ-03
158+
name: Appropriate Scale
159+
score: 4
160+
max: 4
161+
passed: true
162+
comment: Realistic values for SaaS retention (100% to ~25% over 9 months).
163+
code_quality:
164+
score: 8
165+
max: 10
166+
items:
167+
- id: CQ-01
168+
name: KISS Structure
169+
score: 1
170+
max: 3
171+
passed: false
172+
comment: Custom class subclassing pygal Graph. Necessary for pygal but deviates
173+
from flat structure.
174+
- id: CQ-02
175+
name: Reproducibility
176+
score: 2
177+
max: 2
178+
passed: true
179+
comment: np.random.seed(42) set.
180+
- id: CQ-03
181+
name: Clean Imports
182+
score: 2
183+
max: 2
184+
passed: true
185+
comment: All imports used.
186+
- id: CQ-04
187+
name: Code Elegance
188+
score: 2
189+
max: 2
190+
passed: true
191+
comment: Well-organized code, clean color interpolation, no fake UI.
192+
- id: CQ-05
193+
name: Output & API
194+
score: 1
195+
max: 1
196+
passed: true
197+
comment: Saves as plot.png and plot.svg.
198+
library_mastery:
199+
score: 8
200+
max: 10
201+
items:
202+
- id: LM-01
203+
name: Idiomatic Usage
204+
score: 4
205+
max: 5
206+
passed: true
207+
comment: Properly subclasses Graph with _plot()/_compute() overrides. Uses
208+
SVG node system and Style class.
209+
- id: LM-02
210+
name: Distinctive Features
211+
score: 4
212+
max: 5
213+
passed: true
214+
comment: Uses pygal-specific Graph subclass, self.svg.node(), _tooltip_data(),
215+
and Style system.
216+
verdict: REJECTED
217+
impl_tags:
218+
dependencies: []
219+
techniques:
220+
- colorbar
221+
- annotations
222+
- hover-tooltips
223+
- html-export
224+
patterns:
225+
- data-generation
226+
- matrix-construction
227+
- iteration-over-groups
228+
dataprep: []
229+
styling:
230+
- custom-colormap
231+
- edge-highlighting

0 commit comments

Comments
 (0)