Skip to content

Commit bb1e45a

Browse files
chore(altair): update quality score 89 and review feedback for heatmap-basic
1 parent e606133 commit bb1e45a

2 files changed

Lines changed: 71 additions & 79 deletions

File tree

plots/heatmap-basic/implementations/altair.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: altair 6.0.0 | Python 3.14.3
4-
Quality: 87/100 | Updated: 2026-02-15
4+
Quality: 89/100 | Updated: 2026-02-15
55
"""
66

77
import altair as alt
Lines changed: 69 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
library: altair
22
specification_id: heatmap-basic
33
created: '2025-12-23T00:48:16Z'
4-
updated: '2026-02-15T21:39:54Z'
4+
updated: '2026-02-15T21:49:09Z'
55
generated_by: claude-opus-4-6
66
workflow_run: 20447968624
77
issue: 0
@@ -10,7 +10,7 @@ library_version: 6.0.0
1010
preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.png
1111
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot_thumb.png
1212
preview_html: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.html
13-
quality_score: 87
13+
quality_score: 89
1414
impl_tags:
1515
dependencies: []
1616
techniques:
@@ -20,47 +20,42 @@ impl_tags:
2020
- html-export
2121
patterns:
2222
- data-generation
23-
- iteration-over-groups
2423
dataprep:
2524
- correlation-matrix
2625
styling:
2726
- custom-colormap
2827
- edge-highlighting
2928
review:
3029
strengths:
31-
- Excellent use of Altair conditional encoding (alt.when().then().otherwise()) for
32-
adaptive text color — distinctively Altair feature that enhances readability
33-
- Strong-correlation border highlighting (dark borders on |r| >= 0.7) adds meaningful
34-
visual hierarchy and guides reader to important relationships
35-
- Well-crafted data with realistic injected correlations creating a believable weather
36-
scenario with both positive and negative relationships
37-
- White cell borders with rounded corners and clean grid-free design create a polished
38-
modern look
39-
- Informative subtitle contextualizes the data being displayed
30+
- Adaptive text color using alt.when() conditional encoding — white on dark cells,
31+
dark on light cells — excellent readability
32+
- Highlight borders on strong correlations (|r| >= 0.7) via transform_filter create
33+
clear visual hierarchy
34+
- Realistic weather correlation data with plausible injected relationships showing
35+
variety of positive and negative correlations
36+
- Clean layered composition (heatmap + highlight + text) is idiomatic Altair
37+
- White cell separators with corner radius give a polished, modern appearance
4038
weaknesses:
41-
- Canvas utilization could be improved — noticeable empty space around the heatmap,
42-
and the colorbar legend floats somewhat isolated to the right
43-
- Both axes labeled Weather Variable is redundant — consider differentiating or
44-
removing one axis title
45-
- Aesthetic sophistication could be elevated with more refined design choices (e.g.,
46-
subtle background tint, more intentional spacing) to push DE-01 from 6 to 7-8
47-
- Minor label cramping on some angled x-axis labels at the edges
48-
image_description: 'The plot displays an 8x8 pairwise Pearson correlation matrix
49-
heatmap for weather variables: Temperature, Humidity, Wind Speed, Pressure, Visibility,
50-
Cloud Cover, Precipitation, and UV Index. The color scheme uses a blue-orange
51-
diverging palette (Altair''s "blueorange") centered at 0, where orange/brown indicates
52-
positive correlations and blue indicates negative correlations. Each cell contains
53-
a numeric annotation showing the correlation coefficient to two decimal places.
54-
Cells with strong correlations (|r| >= 0.7) are highlighted with darker borders.
55-
Text color adapts — white on dark cells, dark gray on light cells. The diagonal
56-
shows 1.00 values. X-axis labels are positioned at the top at a -30 degree angle;
57-
Y-axis labels are on the left. Both axes are labeled "Weather Variable." A vertical
58-
color gradient legend labeled "Correlation" appears on the right side ranging
59-
from -1.0 to 1.0. The title reads "heatmap-basic · altair · pyplots.ai" with subtitle
60-
"Pairwise Pearson correlation coefficients for 8 weather metrics." White cell
61-
borders with rounded corners separate the cells. Notable correlations include
62-
Cloud Cover and Visibility (-0.77), Cloud Cover and Precipitation (0.63), and
63-
Humidity and Cloud Cover (0.54).'
39+
- Output dimensions (~2800x2920 at scale_factor=4.0) don't match either target format
40+
(4800x2700 landscape or 3600x3600 square) — should use width/height that scales
41+
to a target size
42+
- Axis titles set to None — while acceptable for a correlation matrix, adding 'Weather
43+
Variable' or similar would improve self-documentation
44+
- Column label angle of -35 degrees gets tight with longer variable names — a steeper
45+
angle or top-padding adjustment would help
46+
image_description: 'The plot displays an 8x8 correlation heatmap of weather variables
47+
(Temperature, Humidity, Wind Speed, Pressure, Visibility, Cloud Cover, Precipitation,
48+
UV Index). The color scheme is a blue-orange diverging palette centered at zero:
49+
strong positive correlations appear in dark orange/brown, strong negative correlations
50+
in dark blue, and near-zero values in light cream/white. Each cell contains a
51+
bold numeric annotation showing the Pearson correlation coefficient to two decimal
52+
places. Text color adapts — white on strongly colored cells, dark gray on lighter
53+
cells. Cells with |r| >= 0.7 have darker highlighted borders. Column labels are
54+
rotated at -35 degrees along the top axis, row labels are on the left. A vertical
55+
"Correlation" colorbar legend is positioned on the right. The title reads "heatmap-basic
56+
· altair · pyplots.ai" with a subtitle "Pairwise Pearson correlation coefficients
57+
for 8 weather metrics." The layout is clean with white cell separators and rounded
58+
corners.'
6459
criteria_checklist:
6560
visual_quality:
6661
score: 26
@@ -71,67 +66,66 @@ review:
7166
score: 8
7267
max: 8
7368
passed: true
74-
comment: 'All font sizes explicitly set: title 28pt, axis title 20pt, tick
75-
labels 16pt, annotations 16pt bold, legend title 18pt, legend labels 16pt'
69+
comment: 'All font sizes explicitly set: title 26pt, subtitle 16pt, axis labels
70+
15pt, cell text 15pt bold'
7671
- id: VQ-02
7772
name: No Overlap
7873
score: 5
7974
max: 6
8075
passed: true
81-
comment: X-axis labels angled at -30 degrees mostly avoid overlap but slight
82-
cramping on end labels
76+
comment: Column labels at -35 degrees slightly tight but still readable, no
77+
actual overlap
8378
- id: VQ-03
8479
name: Element Visibility
8580
score: 6
8681
max: 6
8782
passed: true
88-
comment: All 64 cells clearly visible with strong color differentiation
83+
comment: Cells optimally sized for 8x8 matrix
8984
- id: VQ-04
9085
name: Color Accessibility
9186
score: 4
9287
max: 4
9388
passed: true
94-
comment: Blue-orange diverging scheme is colorblind-safe with good contrast
89+
comment: Blue-orange diverging scheme is colorblind-safe
9590
- id: VQ-05
9691
name: Layout & Canvas
9792
score: 2
9893
max: 4
9994
passed: false
100-
comment: Noticeable empty space around heatmap, colorbar legend somewhat isolated
101-
to the right
95+
comment: Output dimensions ~2800x2920 don't match target formats (4800x2700
96+
or 3600x3600)
10297
- id: VQ-06
10398
name: Axis Labels & Title
10499
score: 1
105100
max: 2
106-
passed: false
107-
comment: Weather Variable is descriptive but redundant on both axes, no units
108-
(though not applicable for correlation)
101+
passed: true
102+
comment: Axis titles set to None; acceptable for correlation matrix but could
103+
be more descriptive
109104
design_excellence:
110-
score: 14
105+
score: 15
111106
max: 20
112107
items:
113108
- id: DE-01
114109
name: Aesthetic Sophistication
115110
score: 6
116111
max: 8
117112
passed: true
118-
comment: Strong design with blue-orange scheme, white cell borders with rounded
119-
corners, border highlighting, adaptive text color. Above defaults but not
120-
publication-level.
113+
comment: 'Strong design: white cell borders with corner radius, custom diverging
114+
palette, adaptive text color, highlight borders'
121115
- id: DE-02
122116
name: Visual Refinement
123-
score: 4
117+
score: 5
124118
max: 6
125119
passed: true
126-
comment: Grid removed, view stroke removed, white cell borders, rounded corners,
127-
generous padding. Good refinement visible.
120+
comment: Grid removed, view stroke removed, padding configured, white separators,
121+
rounded corners
128122
- id: DE-03
129123
name: Data Storytelling
130124
score: 4
131125
max: 6
132126
passed: true
133-
comment: Strong-correlation highlighting creates visual hierarchy. Correlation
134-
clusters visible. Subtitle provides context.
127+
comment: Highlight borders on strong correlations create visual hierarchy;
128+
subtitle provides context
135129
spec_compliance:
136130
score: 15
137131
max: 15
@@ -147,20 +141,20 @@ review:
147141
score: 4
148142
max: 4
149143
passed: true
150-
comment: 'All spec features present: diverging colormap, value annotations,
151-
colorbar legend, logical ordering'
144+
comment: Diverging colormap, value annotations, colorbar legend, logical ordering
145+
— all present
152146
- id: SC-03
153147
name: Data Mapping
154148
score: 3
155149
max: 3
156150
passed: true
157-
comment: X/Y correctly mapped as column/row variables
151+
comment: X/Y correctly assigned as Column/Row
158152
- id: SC-04
159153
name: Title & Legend
160154
score: 3
161155
max: 3
162156
passed: true
163-
comment: Title format correct, colorbar legend labeled Correlation
157+
comment: Correct title format with descriptive subtitle
164158
data_quality:
165159
score: 14
166160
max: 15
@@ -170,30 +164,29 @@ review:
170164
score: 5
171165
max: 6
172166
passed: true
173-
comment: Shows positive, negative, and near-zero correlations. Diagonal 1.00
174-
values. Good range but could have stronger negatives.
167+
comment: Shows strong positive, strong negative, weak, and diagonal correlations
175168
- id: DQ-02
176169
name: Realistic Context
177170
score: 5
178171
max: 5
179172
passed: true
180-
comment: Weather metrics correlation is a real, neutral, comprehensible scenario
173+
comment: Weather metrics correlation is a real, neutral scenario
181174
- id: DQ-03
182175
name: Appropriate Scale
183176
score: 4
184177
max: 4
185178
passed: true
186-
comment: All values in [-1, 1] range, realistic for weather data correlations
179+
comment: All values realistic and within [-1, 1]
187180
code_quality:
188-
score: 9
181+
score: 10
189182
max: 10
190183
items:
191184
- id: CQ-01
192185
name: KISS Structure
193186
score: 3
194187
max: 3
195188
passed: true
196-
comment: 'Clean flow: imports, data generation, plot, save. No functions/classes.'
189+
comment: Clean importsdata plot → save
197190
- id: CQ-02
198191
name: Reproducibility
199192
score: 2
@@ -205,21 +198,20 @@ review:
205198
score: 2
206199
max: 2
207200
passed: true
208-
comment: All imports used (altair, numpy, pandas)
201+
comment: Only numpy, pandas, altair — all used
209202
- id: CQ-04
210203
name: Code Elegance
211-
score: 1
204+
score: 2
212205
max: 2
213-
passed: false
214-
comment: 'Slightly verbose: abs_value column only used for highlight filter,
215-
records list-append loop could be more concise'
206+
passed: true
207+
comment: Well-organized, list comprehension, layered composition
216208
- id: CQ-05
217209
name: Output & API
218210
score: 1
219211
max: 1
220212
passed: true
221-
comment: Saves as plot.png and plot.html, no deprecated APIs
222-
library_features:
213+
comment: Saves plot.png and plot.html
214+
library_mastery:
223215
score: 9
224216
max: 10
225217
items:
@@ -228,13 +220,13 @@ review:
228220
score: 5
229221
max: 5
230222
passed: true
231-
comment: 'Expert use of Altair declarative grammar: proper encoding types,
232-
alt.X/Y with axis config, alt.Color with Scale, alt.Legend, alt.Title'
223+
comment: Declarative grammar, encoding types, layered composition, transform_filter,
224+
alt.when() conditional
233225
- id: LM-02
234226
name: Distinctive Features
235227
score: 4
236228
max: 5
237229
passed: true
238-
comment: 'Uses Altair-specific features: layer composition, alt.when().then().otherwise()
239-
conditional encoding, tooltip encoding, declarative mark composition'
240-
verdict: REJECTED
230+
comment: alt.when().then().otherwise() for adaptive text, transform_filter
231+
for highlights, tooltip encoding, + layer operator
232+
verdict: APPROVED

0 commit comments

Comments
 (0)