Skip to content

Commit 049791e

Browse files
chore(plotnine): update quality score 88 and review feedback for heatmap-cohort-retention
1 parent 57f07fe commit 049791e

2 files changed

Lines changed: 70 additions & 62 deletions

File tree

plots/heatmap-cohort-retention/implementations/plotnine.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
heatmap-cohort-retention: Cohort Retention Heatmap
33
Library: plotnine 0.15.3 | Python 3.14.3
4-
Quality: 85/100 | Created: 2026-03-16
4+
Quality: 88/100 | Created: 2026-03-16
55
"""
66

77
import numpy as np

plots/heatmap-cohort-retention/metadata/plotnine.yaml

Lines changed: 68 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
library: plotnine
22
specification_id: heatmap-cohort-retention
33
created: '2026-03-16T20:45:25Z'
4-
updated: '2026-03-16T20:57:00Z'
4+
updated: '2026-03-16T21:04:52Z'
55
generated_by: claude-opus-4-5-20251101
66
workflow_run: 23165008156
77
issue: 4570
@@ -10,34 +10,34 @@ library_version: 0.15.3
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-cohort-retention/plotnine/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-cohort-retention/plotnine/plot_thumb.png
1212
preview_html: null
13-
quality_score: 85
13+
quality_score: 88
1414
review:
1515
strengths:
16-
- Perfect spec compliance with all required features (triangular shape, cell annotations,
17-
cohort sizes, color bar)
18-
- Clean well-structured code following KISS principles with proper reproducibility
19-
- Custom color palette with thoughtful text color contrast (white on dark, dark
20-
on light cells)
21-
- 'Good visual refinement: grid removed, tile borders, custom background'
16+
- Excellent spec compliance — all required features implemented perfectly (triangular
17+
shape, cell annotations, cohort sizes, colorbar)
18+
- Strong data storytelling with retention improvement annotation and insightful
19+
subtitle
20+
- Custom 3-stop color palette (cream to teal to navy) is visually distinctive and
21+
cohesive
22+
- Conditional text coloring (white on dark, dark on light) ensures readability throughout
23+
- Clean well-structured code following KISS principles
2224
weaknesses:
23-
- Best Month 3 annotation is weak storytelling — 50% is not compelling and annotation
24-
floats disconnectedly
25-
- Subtitle claims improving retention trends but data barely shows this (trend_bonus
26-
too small)
27-
- 8-stop color gradient creates muddy mid-range transitions
28-
- Cell text size slightly small for optimal readability
29-
image_description: 'The plot displays a triangular cohort retention heatmap with
30-
10 monthly cohorts (Jan 2024 – Oct 2024) on the y-axis and months since signup
31-
(Month 0 – Month 9) on the x-axis. Each cell contains a bold retention percentage.
32-
The color gradient transitions from warm amber/cream (low retention, ~11%) through
33-
teal to deep navy (high retention, 100%). White tile borders separate cells cleanly.
34-
The triangular shape correctly emerges with earlier cohorts having more columns.
35-
Cohort sizes (e.g., n=1,200) appear in parentheses alongside cohort labels. A
36-
"Retention %" color bar legend is positioned on the right. An annotation "Best
37-
Month 3: Feb 2024 50%" floats in the empty triangle area. Title follows the required
38-
format: "heatmap-cohort-retention · plotnine · pyplots.ai". Subtitle reads "Monthly
39-
cohort retention — later cohorts show improving retention trends" in italic. Background
40-
is light gray.'
25+
- Color palette not perceptually uniform — consider viridis or cividis for more
26+
even gradation
27+
- X-axis label rotation at 45 degrees slightly awkward — shorter labels or horizontal
28+
orientation would be cleaner
29+
image_description: The plot displays a triangular cohort retention heatmap with
30+
10 monthly cohorts (Jan 2024 – Oct 2024) on the y-axis, each labeled with cohort
31+
size (e.g., "Jan 2024 (n=1,200)"). The x-axis shows "Month 0" through "Month 9"
32+
rotated at 45 degrees. Cells use a 3-stop sequential color gradient from cream/light
33+
yellow (low retention) through teal to deep navy (high retention). Each cell contains
34+
bold white or dark text showing the retention percentage. The triangular shape
35+
is correct — Jan 2024 has 10 columns, Oct 2024 has 1. Period 0 is 100% for all
36+
cohorts. A colorbar legend labeled "Retention %" appears on the right. An annotation
37+
in the empty lower-right area reads "Month 4 retention improved +8pp from Jan→Jun
38+
2024". The title follows the required format "heatmap-cohort-retention · plotnine
39+
· pyplots.ai". Background is a subtle off-white (#fafafa). Overall layout is clean
40+
and professional.
4141
criteria_checklist:
4242
visual_quality:
4343
score: 27
@@ -48,64 +48,68 @@ review:
4848
score: 7
4949
max: 8
5050
passed: true
51-
comment: All font sizes explicitly set. Cell text size 11 could be slightly
52-
larger (12-13).
51+
comment: All font sizes explicitly set (title 26pt, subtitle 18pt, axis text
52+
16pt, cell text 13pt bold). All readable; cell text slightly small but clear.
5353
- id: VQ-02
5454
name: No Overlap
5555
score: 6
5656
max: 6
5757
passed: true
58-
comment: No overlapping text anywhere.
58+
comment: No overlapping text anywhere. Annotation placed in empty triangular
59+
area.
5960
- id: VQ-03
6061
name: Element Visibility
6162
score: 6
6263
max: 6
6364
passed: true
64-
comment: All tiles clearly visible with strong color differentiation.
65+
comment: All tiles clearly visible with good color differentiation across
66+
the retention range.
6567
- id: VQ-04
6668
name: Color Accessibility
6769
score: 3
6870
max: 4
6971
passed: true
70-
comment: Custom gradient is distinguishable but not a standard colorblind-safe
71-
palette.
72+
comment: Sequential cream-teal-navy gradient is colorblind-friendly but not
73+
perceptually uniform.
7274
- id: VQ-05
7375
name: Layout & Canvas
7476
score: 3
7577
max: 4
7678
passed: true
77-
comment: Good proportions. Empty triangle area and floating annotation create
78-
slight imbalance.
79+
comment: Good 16:9 proportions, nothing cut off. X-axis labels rotated 45
80+
degrees slightly awkward.
7981
- id: VQ-06
8082
name: Axis Labels & Title
8183
score: 2
8284
max: 2
8385
passed: true
84-
comment: Descriptive labels with context.
86+
comment: Months Since Signup is descriptive, y-axis shows cohort labels with
87+
sizes.
8588
design_excellence:
86-
score: 12
89+
score: 14
8790
max: 20
8891
items:
8992
- id: DE-01
9093
name: Aesthetic Sophistication
91-
score: 5
94+
score: 6
9295
max: 8
9396
passed: true
94-
comment: Custom palette and tile borders above defaults, but multi-stop gradient
95-
creates muddy mid-range.
97+
comment: Custom 3-stop color palette, conditional text coloring, cohesive
98+
design clearly above defaults.
9699
- id: DE-02
97100
name: Visual Refinement
98101
score: 4
99102
max: 6
100103
passed: true
101-
comment: Grid removed, custom background, italic subtitle, white tile borders.
104+
comment: Panel grid removed, custom tile borders, subtle off-white background,
105+
clean whitespace.
102106
- id: DE-03
103107
name: Data Storytelling
104-
score: 3
108+
score: 4
105109
max: 6
106110
passed: true
107-
comment: Subtitle and annotation add narrative but Best Month 3 at 50% is
108-
uncompelling.
111+
comment: Annotation comparing Jan vs Jun retention creates focal point. Subtitle
112+
communicates key insight.
109113
spec_compliance:
110114
score: 15
111115
max: 15
@@ -121,42 +125,45 @@ review:
121125
score: 4
122126
max: 4
123127
passed: true
124-
comment: 'All features present: triangular shape, cell annotations, cohort
125-
sizes, color bar.'
128+
comment: 'All spec features present: triangular shape, retention percentages
129+
in cells, cohort sizes, colorbar, sequential colormap.'
126130
- id: SC-03
127131
name: Data Mapping
128132
score: 3
129133
max: 3
130134
passed: true
131-
comment: Correct mapping of periods, cohorts, and retention rate.
135+
comment: X=periods, Y=cohorts, fill=retention_rate. All correct.
132136
- id: SC-04
133137
name: Title & Legend
134138
score: 3
135139
max: 3
136140
passed: true
137-
comment: Correct title format and color bar legend.
141+
comment: Title matches required format. Colorbar legend labeled Retention
142+
%.
138143
data_quality:
139-
score: 14
144+
score: 15
140145
max: 15
141146
items:
142147
- id: DQ-01
143148
name: Feature Coverage
144-
score: 5
149+
score: 6
145150
max: 6
146151
passed: true
147-
comment: Shows all aspects but improving trend claim barely visible in data.
152+
comment: 'Shows all aspects: triangular shape, exponential decay, cohort variation,
153+
period 0 = 100%, improving trend.'
148154
- id: DQ-02
149155
name: Realistic Context
150156
score: 5
151157
max: 5
152158
passed: true
153-
comment: Realistic SaaS cohort retention scenario.
159+
comment: SaaS monthly cohort retention with realistic user counts and decay
160+
patterns. Neutral business domain.
154161
- id: DQ-03
155162
name: Appropriate Scale
156163
score: 4
157164
max: 4
158165
passed: true
159-
comment: Sensible values with exponential decay.
166+
comment: 10 cohorts, sizes 980-1450, realistic exponential decay with noise.
160167
code_quality:
161168
score: 10
162169
max: 10
@@ -166,7 +173,7 @@ review:
166173
score: 3
167174
max: 3
168175
passed: true
169-
comment: Linear script structure.
176+
comment: 'Flat script: imports, data, plot, save. No functions or classes.'
170177
- id: CQ-02
171178
name: Reproducibility
172179
score: 2
@@ -178,19 +185,19 @@ review:
178185
score: 2
179186
max: 2
180187
passed: true
181-
comment: All imports used.
188+
comment: All imports are used.
182189
- id: CQ-04
183190
name: Code Elegance
184191
score: 2
185192
max: 2
186193
passed: true
187-
comment: Clean, well-organized, no fake UI.
194+
comment: Clean, appropriate complexity. No fake UI or over-engineering.
188195
- id: CQ-05
189196
name: Output & API
190197
score: 1
191198
max: 1
192199
passed: true
193-
comment: Saves as plot.png with current API.
200+
comment: Saves as plot.png with current plotnine API.
194201
library_mastery:
195202
score: 7
196203
max: 10
@@ -200,15 +207,16 @@ review:
200207
score: 4
201208
max: 5
202209
passed: true
203-
comment: Good grammar of graphics usage with proper layering and scales.
210+
comment: 'Good grammar of graphics composition: aes, geom_tile, geom_text,
211+
scale_fill_gradientn, theme_minimal with customization.'
204212
- id: LM-02
205213
name: Distinctive Features
206214
score: 3
207215
max: 5
208216
passed: true
209-
comment: Uses scale_fill_gradientn, scale_color_identity, annotate. Grammar
210-
of graphics composition is distinctly plotnine.
211-
verdict: REJECTED
217+
comment: Uses scale_fill_gradientn, scale_color_identity for conditional text
218+
colors, pd.Categorical ordering, annotate layer.
219+
verdict: APPROVED
212220
impl_tags:
213221
dependencies: []
214222
techniques:

0 commit comments

Comments
 (0)