Skip to content

Commit ced8294

Browse files
chore(plotnine): update quality score 86 and review feedback for heatmap-basic
1 parent 810bab1 commit ced8294

2 files changed

Lines changed: 92 additions & 79 deletions

File tree

plots/heatmap-basic/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-basic: Basic Heatmap
33
Library: plotnine 0.15.3 | Python 3.14.3
4-
Quality: 89/100 | Updated: 2026-02-15
4+
Quality: 86/100 | Updated: 2026-02-15
55
"""
66

77
import numpy as np
Lines changed: 90 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
library: plotnine
22
specification_id: heatmap-basic
33
created: '2025-12-23T00:47:36Z'
4-
updated: '2026-02-15T21:38:34Z'
4+
updated: '2026-02-15T21:46:32Z'
55
generated_by: claude-opus-4-6
66
workflow_run: 20447967616
77
issue: 0
@@ -10,7 +10,7 @@ library_version: 0.15.3
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/plotnine/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/plotnine/plot_thumb.png
1212
preview_html: null
13-
quality_score: 89
13+
quality_score: 86
1414
impl_tags:
1515
dependencies: []
1616
techniques:
@@ -19,84 +19,95 @@ impl_tags:
1919
patterns:
2020
- data-generation
2121
- matrix-construction
22-
- iteration-over-groups
2322
dataprep: []
2423
styling:
2524
- custom-colormap
2625
- edge-highlighting
2726
review:
2827
strengths:
29-
- Excellent use of plotnine grammar of graphics with scale_fill_gradient2 for a
30-
Python-themed diverging palette (blue-to-yellow)
31-
- Bold cell annotations with conditional text color (white on dark, dark on light)
32-
ensure readability across all cells
33-
- Data tells a compelling recovery story — the left-to-right blue-to-yellow progression
34-
is immediately apparent
35-
- Clean KISS code structure with appropriate use of pd.Categorical for axis ordering
36-
- 'All spec requirements fully met: diverging colormap, annotations, colorbar, logical
28+
- Excellent use of plotnine grammar of graphics with idiomatic layer composition
29+
(geom_tile + geom_text)
30+
- Smart conditional text coloring via scale_color_identity ensures readability across
31+
all cell backgrounds
32+
- Clear data storytelling with recovery trend from negative (blue) to positive (gold)
33+
across quarters
34+
- Custom diverging palette (steel blue to off-white to gold) with well-chosen midpoint=0
35+
- Deliberate extreme values (HR -32.5%, Sales +38.2%) create visual focal points
36+
- Realistic neutral business scenario with plausible growth rate values
37+
- 'All spec requirements met: diverging colormap, cell annotations, colorbar, logical
3738
ordering'
3839
weaknesses:
39-
- Axis labels lack units or additional context — consider appending percent or YoY
40-
context to subtitle
41-
- Light yellow cells could benefit from slightly stronger saturation for better
42-
visual contrast
43-
- Left margin has slightly more whitespace than needed, reducing canvas efficiency
40+
- Title font size 22pt slightly under the 24pt guideline for optimal readability
41+
at full resolution
42+
- Mid-range color contrast could be stronger — values near zero on off-white background
43+
are less visually distinct
44+
- Code uses nested loops for matrix construction where vectorized numpy operations
45+
could be more concise
46+
- Categorical axis labels Quarter and Department lack units (though units are not
47+
natural for categories)
4448
image_description: 'The plot displays an 8x8 heatmap titled "Quarterly Growth by
45-
Department · heatmap-basic · plotnine · pyplots.ai." Eight departments (Engineering,
46-
Marketing, Sales, Finance, Operations, HR, Research, Support) are arranged on
47-
the y-axis, and eight quarters (Q1 ''23 through Q4 ''24) on the x-axis. A diverging
48-
color scheme transitions from steel blue (#306998) for negative values through
49-
off-white for near-zero to golden yellow (#FFD43B) for positive values. Each cell
50-
contains a bold annotation showing the exact growth percentage with a +/- sign.
51-
White borders cleanly separate the tiles. The colorbar on the right is labeled
52-
"Growth (%)" with a scale from approximately -20 to +20. X-axis labels are rotated
53-
45 degrees for readability. The visual story is immediately clear: a recovery
54-
trend flows from left (blue/negative) to right (yellow/positive), with departmental
55-
variation adding depth. HR and Support show the deepest early negatives while
56-
Sales and Research recover most strongly.'
49+
Department · heatmap-basic · plotnine · pyplots.ai" with a subtitle "Year-over-year
50+
growth rate (%) across departments, Q1 2023 – Q4 2024". The Y-axis lists eight
51+
departments (Engineering, Marketing, Sales, Finance, Operations, HR, Research,
52+
Support) and the X-axis shows eight quarters (Q1 ''23 through Q4 ''24, rotated
53+
45 degrees). Each cell is colored using a diverging scheme: steel blue for negative
54+
values, off-white/cream for near-zero, and gold/amber for positive values. Every
55+
cell contains a bold annotation showing the growth rate with a sign prefix (e.g.,
56+
"-32.5", "+38.2"). A vertical colorbar legend on the right labeled "Growth (%)"
57+
shows the scale from approximately -20 to +40. The overall layout has a light
58+
gray (#fafafa) background, white cell borders separating tiles, and no grid lines.
59+
The data tells a clear recovery story: the left columns are predominantly blue
60+
(negative growth) transitioning to gold (positive growth) on the right. Notable
61+
extremes include HR at -32.5% in Q1 ''23 (deepest blue) and Sales at +38.2% in
62+
Q4 ''24 (deepest gold). Text contrast is managed with white text on dark blue
63+
cells, dark gray on mid-range cells, and dark brown/amber on bright gold cells.'
5764
criteria_checklist:
5865
visual_quality:
59-
score: 27
66+
score: 26
6067
max: 30
6168
items:
6269
- id: VQ-01
6370
name: Text Legibility
64-
score: 8
71+
score: 7
6572
max: 8
6673
passed: true
67-
comment: 'All font sizes explicitly set: title 24pt, axis titles 20pt, axis
68-
text 16pt, legend 14-16pt'
74+
comment: Font sizes explicitly set (title=22, subtitle=15, axis titles=18,
75+
axis text=15, annotations size=10). Title slightly under 24pt guideline
76+
but all text clearly readable.
6977
- id: VQ-02
7078
name: No Overlap
7179
score: 6
7280
max: 6
7381
passed: true
74-
comment: No overlapping text; rotated x-labels and well-sized annotations
82+
comment: No overlapping text anywhere. Rotated x-axis labels, well-spaced
83+
cells.
7584
- id: VQ-03
7685
name: Element Visibility
7786
score: 6
7887
max: 6
7988
passed: true
80-
comment: Tiles perfectly fill the grid, annotations clearly visible
89+
comment: Tiles perfectly sized for 8x8 grid, annotations clear and well-positioned.
8190
- id: VQ-04
8291
name: Color Accessibility
8392
score: 3
8493
max: 4
85-
passed: false
86-
comment: Blue-to-yellow diverging is colorblind-friendly; light yellow cells
87-
have slightly lower contrast with dark text
94+
passed: true
95+
comment: Blue-to-gold diverging scheme avoids red-green issues. Mid-range
96+
contrast could be slightly stronger.
8897
- id: VQ-05
89-
name: Layout Balance
98+
name: Layout & Canvas
9099
score: 3
91100
max: 4
92-
passed: false
93-
comment: Good canvas utilization; slight excess whitespace on left side
101+
passed: true
102+
comment: Good canvas utilization. Minor wasted space at top-left and between
103+
subtitle and heatmap body.
94104
- id: VQ-06
95105
name: Axis Labels & Title
96106
score: 1
97107
max: 2
98-
passed: false
99-
comment: Descriptive labels but lack units; growth % only in colorbar legend
108+
passed: true
109+
comment: Descriptive labels but categorical axes lack units. Subtitle provides
110+
percent context.
100111
design_excellence:
101112
score: 14
102113
max: 20
@@ -105,51 +116,52 @@ review:
105116
name: Aesthetic Sophistication
106117
score: 6
107118
max: 8
108-
passed: false
109-
comment: Custom Python Blue-to-Yellow palette is thematic; bold annotations,
110-
white borders, clearly above defaults
119+
passed: true
120+
comment: Custom diverging palette, intentional typography hierarchy, conditional
121+
text coloring. Clearly above defaults.
111122
- id: DE-02
112123
name: Visual Refinement
113124
score: 4
114125
max: 6
115-
passed: false
116-
comment: Grid removed, minimal theme, white backgrounds; good but not fully
117-
publication-level polish
126+
passed: true
127+
comment: Grid removed, minimal theme, white cell borders, light background,
128+
explicit panel/plot background styling.
118129
- id: DE-03
119130
name: Data Storytelling
120131
score: 4
121132
max: 6
122-
passed: false
123-
comment: Recovery trend immediately visible through color gradient; department
124-
variation adds narrative depth
133+
passed: true
134+
comment: Clear recovery narrative. Extreme values create focal points. Conditional
135+
text coloring adds visual hierarchy.
125136
spec_compliance:
126-
score: 15
137+
score: 14
127138
max: 15
128139
items:
129140
- id: SC-01
130141
name: Plot Type
131142
score: 5
132143
max: 5
133144
passed: true
134-
comment: Correct heatmap via geom_tile
145+
comment: Correct heatmap using geom_tile.
135146
- id: SC-02
136147
name: Required Features
137148
score: 4
138149
max: 4
139150
passed: true
140-
comment: Diverging colormap, annotations, colorbar, logical ordering all present
151+
comment: 'All spec features present: diverging colormap, value annotations,
152+
colorbar legend, logically ordered rows/columns.'
141153
- id: SC-03
142154
name: Data Mapping
143155
score: 3
144156
max: 3
145157
passed: true
146-
comment: X/Y correctly assigned
158+
comment: X=Quarter, Y=Department, value mapped to fill correctly.
147159
- id: SC-04
148-
name: Title Format
149-
score: 3
160+
name: Title & Legend
161+
score: 2
150162
max: 3
151163
passed: true
152-
comment: Correct format with spec-id, library, pyplots.ai
164+
comment: Title format correct with descriptive prefix. Colorbar legend appropriate.
153165
data_quality:
154166
score: 14
155167
max: 15
@@ -158,55 +170,56 @@ review:
158170
name: Feature Coverage
159171
score: 5
160172
max: 6
161-
passed: false
162-
comment: Shows positive/negative values, temporal trend, departmental variation;
163-
could benefit from more extreme outliers
173+
passed: true
174+
comment: Shows positive/negative values, extreme outliers, gradual trends,
175+
departmental variation.
164176
- id: DQ-02
165177
name: Realistic Context
166178
score: 5
167179
max: 5
168180
passed: true
169-
comment: Quarterly department growth rates — realistic neutral business scenario
181+
comment: Realistic business scenario with department growth rates. Neutral
182+
and comprehensible.
170183
- id: DQ-03
171184
name: Appropriate Scale
172185
score: 4
173186
max: 4
174187
passed: true
175-
comment: Values from -22% to +30% are realistic for quarterly performance
188+
comment: Growth rates from -32.5% to +38.2% are realistic for business context.
176189
code_quality:
177-
score: 10
190+
score: 9
178191
max: 10
179192
items:
180193
- id: CQ-01
181194
name: KISS Structure
182195
score: 3
183196
max: 3
184197
passed: true
185-
comment: Imports, data, plot, save — no functions or classes
198+
comment: Clean imports, data, plot, save structure.
186199
- id: CQ-02
187200
name: Reproducibility
188201
score: 2
189202
max: 2
190203
passed: true
191-
comment: np.random.seed(42)
204+
comment: np.random.seed(42) set.
192205
- id: CQ-03
193206
name: Clean Imports
194207
score: 2
195208
max: 2
196209
passed: true
197-
comment: All imports used
210+
comment: All imports used.
198211
- id: CQ-04
199212
name: Code Elegance
200-
score: 2
213+
score: 1
201214
max: 2
202-
passed: true
203-
comment: Clean conditional text color logic, appropriate complexity
215+
passed: false
216+
comment: Slightly verbose with nested loops for matrix and DataFrame construction.
204217
- id: CQ-05
205218
name: Output & API
206219
score: 1
207220
max: 1
208221
passed: true
209-
comment: Saves as plot.png, no deprecated functions
222+
comment: Saves as plot.png, no deprecated functions.
210223
library_mastery:
211224
score: 9
212225
max: 10
@@ -216,13 +229,13 @@ review:
216229
score: 5
217230
max: 5
218231
passed: true
219-
comment: Expert grammar-of-graphics composition, proper aes(), scales, themes,
220-
pd.Categorical ordering
232+
comment: Excellent ggplot2-style grammar with aes mappings, geom layering,
233+
scales, and theme customization.
221234
- id: LM-02
222235
name: Distinctive Features
223236
score: 4
224237
max: 5
225-
passed: false
226-
comment: scale_fill_gradient2 for diverging, scale_color_identity for conditional
227-
text, pd.Categorical for axis ordering
228-
verdict: REJECTED
238+
passed: true
239+
comment: Uses scale_fill_gradient2, scale_color_identity for conditional text,
240+
pd.Categorical for ordered factors.
241+
verdict: APPROVED

0 commit comments

Comments
 (0)