Skip to content

Commit 66bd44d

Browse files
chore(plotnine): update quality score 92 and review feedback for heatmap-basic
1 parent fa67e35 commit 66bd44d

2 files changed

Lines changed: 78 additions & 87 deletions

File tree

plots/heatmap-basic/implementations/plotnine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +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: 92/100 | Updated: 2026-02-16
45
"""
56

67
import numpy as np
Lines changed: 76 additions & 86 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:46:32Z'
4+
updated: '2026-02-16T20:34:16Z'
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: 86
13+
quality_score: 92
1414
impl_tags:
1515
dependencies: []
1616
techniques:
@@ -25,143 +25,134 @@ impl_tags:
2525
- edge-highlighting
2626
review:
2727
strengths:
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
38-
ordering'
28+
- Excellent diverging color palette (steel blue to cream to gold) with well-chosen
29+
midpoint at 0, creating an intuitive visual encoding of positive/negative growth
30+
- Conditional text color logic (white on dark, dark gray on mid, dark brown on gold)
31+
ensures all annotations are readable against their cell background
32+
- Data tells a compelling recovery story with intentional extreme values (HR -32.5
33+
crisis, Sales +38.2 surge) serving as visual focal points
34+
- Clean, idiomatic plotnine code with vectorized data generation and meshgrid-based
35+
long-form DataFrame construction
36+
- 'Fully polished theme: removed grid lines, custom background, generous margins,
37+
rotated tick labels'
3938
weaknesses:
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)
48-
image_description: 'The plot displays an 8x8 heatmap titled "Quarterly Growth by
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.'
39+
- The colorbar legend could benefit from more tick marks to better communicate the
40+
full range of the scale
41+
- Minor wasted horizontal space on the right side between the plot and the legend
42+
area
43+
image_description: 'The heatmap displays an 8x8 grid of quarterly growth rates (%)
44+
across 8 departments (Engineering, Marketing, Sales, Finance, Operations, HR,
45+
Research, Support) over 8 quarters (Q1 ''23 through Q4 ''24). A diverging color
46+
scheme is used: dark steel blue for strongly negative values, cream/beige for
47+
near-zero values, and gold/amber for strongly positive values. Each cell contains
48+
a bold, signed numeric annotation (e.g., "+38.2", "-32.5"). Text color adapts
49+
to background: white on dark blue cells, dark gray on mid-range cells, and dark
50+
brown on gold cells. The title "Quarterly Growth by Department · heatmap-basic
51+
· plotnine · pyplots.ai" is centered and bold at the top, with a subtitle describing
52+
the data. X-axis labels are rotated 45 degrees showing quarter names, Y-axis shows
53+
department names. A vertical colorbar legend labeled "Growth (%)" appears on the
54+
right with a range from approximately -20 to 40. White borders separate cells
55+
cleanly. The background is light gray (#f7f7f7). The plot clearly shows a recovery
56+
narrative from left (negative) to right (positive).'
6457
criteria_checklist:
6558
visual_quality:
66-
score: 26
59+
score: 28
6760
max: 30
6861
items:
6962
- id: VQ-01
7063
name: Text Legibility
71-
score: 7
64+
score: 8
7265
max: 8
7366
passed: true
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.
67+
comment: 'All font sizes explicitly set: title 24pt, axis labels 20pt, ticks
68+
16pt, annotations bold size=10'
7769
- id: VQ-02
7870
name: No Overlap
7971
score: 6
8072
max: 6
8173
passed: true
82-
comment: No overlapping text anywhere. Rotated x-axis labels, well-spaced
83-
cells.
74+
comment: No overlapping text anywhere, rotated x-axis labels, well-spaced
75+
annotations
8476
- id: VQ-03
8577
name: Element Visibility
8678
score: 6
8779
max: 6
8880
passed: true
89-
comment: Tiles perfectly sized for 8x8 grid, annotations clear and well-positioned.
81+
comment: Tiles fill grid perfectly, annotations clearly visible in every cell
9082
- id: VQ-04
9183
name: Color Accessibility
9284
score: 3
9385
max: 4
9486
passed: true
95-
comment: Blue-to-gold diverging scheme avoids red-green issues. Mid-range
96-
contrast could be slightly stronger.
87+
comment: Diverging blue-cream-gold avoids red-green issues; not a standard
88+
perceptually-uniform palette
9789
- id: VQ-05
98-
name: Layout & Canvas
90+
name: Layout Balance
9991
score: 3
10092
max: 4
10193
passed: true
102-
comment: Good canvas utilization. Minor wasted space at top-left and between
103-
subtitle and heatmap body.
94+
comment: Good canvas utilization, minor wasted space near legend on right
10495
- id: VQ-06
10596
name: Axis Labels & Title
106-
score: 1
97+
score: 2
10798
max: 2
10899
passed: true
109-
comment: Descriptive labels but categorical axes lack units. Subtitle provides
110-
percent context.
100+
comment: Descriptive labels with units in annotations and legend
111101
design_excellence:
112-
score: 14
102+
score: 16
113103
max: 20
114104
items:
115105
- id: DE-01
116106
name: Aesthetic Sophistication
117-
score: 6
107+
score: 7
118108
max: 8
119109
passed: true
120-
comment: Custom diverging palette, intentional typography hierarchy, conditional
121-
text coloring. Clearly above defaults.
110+
comment: Custom diverging palette, conditional text colors, white cell borders,
111+
light gray background — publication-quality
122112
- id: DE-02
123113
name: Visual Refinement
124-
score: 4
114+
score: 5
125115
max: 6
126116
passed: true
127-
comment: Grid removed, minimal theme, white cell borders, light background,
128-
explicit panel/plot background styling.
117+
comment: Grid removed, custom backgrounds, generous whitespace, spines absent
118+
— highly polished
129119
- id: DE-03
130120
name: Data Storytelling
131121
score: 4
132122
max: 6
133123
passed: true
134-
comment: Clear recovery narrative. Extreme values create focal points. Conditional
135-
text coloring adds visual hierarchy.
124+
comment: Recovery narrative with extreme focal points, conditional text color
125+
guides attention
136126
spec_compliance:
137-
score: 14
127+
score: 15
138128
max: 15
139129
items:
140130
- id: SC-01
141131
name: Plot Type
142132
score: 5
143133
max: 5
144134
passed: true
145-
comment: Correct heatmap using geom_tile.
135+
comment: Correct heatmap using geom_tile
146136
- id: SC-02
147137
name: Required Features
148138
score: 4
149139
max: 4
150140
passed: true
151-
comment: 'All spec features present: diverging colormap, value annotations,
152-
colorbar legend, logically ordered rows/columns.'
141+
comment: 'All spec features present: diverging colormap, annotations, colorbar,
142+
logical ordering'
153143
- id: SC-03
154144
name: Data Mapping
155145
score: 3
156146
max: 3
157147
passed: true
158-
comment: X=Quarter, Y=Department, value mapped to fill correctly.
148+
comment: X=Quarter, Y=Department, fill=Growth (%) — correct
159149
- id: SC-04
160150
name: Title & Legend
161-
score: 2
151+
score: 3
162152
max: 3
163153
passed: true
164-
comment: Title format correct with descriptive prefix. Colorbar legend appropriate.
154+
comment: Title contains heatmap-basic · plotnine · pyplots.ai, legend labeled
155+
Growth (%)
165156
data_quality:
166157
score: 14
167158
max: 15
@@ -171,55 +162,54 @@ review:
171162
score: 5
172163
max: 6
173164
passed: true
174-
comment: Shows positive/negative values, extreme outliers, gradual trends,
175-
departmental variation.
165+
comment: Shows positive/negative, near-zero, extremes, variation across both
166+
dimensions
176167
- id: DQ-02
177168
name: Realistic Context
178169
score: 5
179170
max: 5
180171
passed: true
181-
comment: Realistic business scenario with department growth rates. Neutral
182-
and comprehensible.
172+
comment: 'Realistic business scenario: quarterly departmental growth rates'
183173
- id: DQ-03
184174
name: Appropriate Scale
185175
score: 4
186176
max: 4
187177
passed: true
188-
comment: Growth rates from -32.5% to +38.2% are realistic for business context.
178+
comment: Growth rates -32.5% to +38.2% are plausible
189179
code_quality:
190-
score: 9
180+
score: 10
191181
max: 10
192182
items:
193183
- id: CQ-01
194184
name: KISS Structure
195185
score: 3
196186
max: 3
197187
passed: true
198-
comment: Clean imports, data, plot, save structure.
188+
comment: Clean importsdataplotsave, no functions/classes
199189
- id: CQ-02
200190
name: Reproducibility
201191
score: 2
202192
max: 2
203193
passed: true
204-
comment: np.random.seed(42) set.
194+
comment: np.random.seed(42)
205195
- id: CQ-03
206196
name: Clean Imports
207197
score: 2
208198
max: 2
209199
passed: true
210-
comment: All imports used.
200+
comment: All imports used
211201
- id: CQ-04
212202
name: Code Elegance
213-
score: 1
203+
score: 2
214204
max: 2
215-
passed: false
216-
comment: Slightly verbose with nested loops for matrix and DataFrame construction.
205+
passed: true
206+
comment: Well-organized, vectorized data generation, appropriate complexity
217207
- id: CQ-05
218208
name: Output & API
219209
score: 1
220210
max: 1
221211
passed: true
222-
comment: Saves as plot.png, no deprecated functions.
212+
comment: Saves as plot.png, no deprecated functions
223213
library_mastery:
224214
score: 9
225215
max: 10
@@ -229,13 +219,13 @@ review:
229219
score: 5
230220
max: 5
231221
passed: true
232-
comment: Excellent ggplot2-style grammar with aes mappings, geom layering,
233-
scales, and theme customization.
222+
comment: 'Idiomatic grammar of graphics: ggplot + aes + geom_tile + geom_text
223+
+ scales + theme'
234224
- id: LM-02
235225
name: Distinctive Features
236226
score: 4
237227
max: 5
238228
passed: true
239-
comment: Uses scale_fill_gradient2, scale_color_identity for conditional text,
240-
pd.Categorical for ordered factors.
229+
comment: scale_fill_gradient2 with midpoint, scale_color_identity for conditional
230+
text, pd.Categorical ordering
241231
verdict: APPROVED

0 commit comments

Comments
 (0)