From 203b0a1b7ca3d087283793bf36f81499b1774559 Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Sun, 15 Feb 2026 22:27:58 +0100 Subject: [PATCH 1/8] =?UTF-8?q?update(heatmap-basic):=20altair=20=E2=80=94?= =?UTF-8?q?=20comprehensive=20quality=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comprehensive quality review: fix weaknesses from prior reviews, preserve strengths, improve quality across all dimensions. --- plots/heatmap-basic/implementations/altair.py | 97 +++++++++++++------ plots/heatmap-basic/metadata/altair.yaml | 8 +- plots/heatmap-basic/specification.md | 2 +- plots/heatmap-basic/specification.yaml | 3 +- 4 files changed, 73 insertions(+), 37 deletions(-) diff --git a/plots/heatmap-basic/implementations/altair.py b/plots/heatmap-basic/implementations/altair.py index bfe8f81b90..f03453e846 100644 --- a/plots/heatmap-basic/implementations/altair.py +++ b/plots/heatmap-basic/implementations/altair.py @@ -1,7 +1,7 @@ -""" pyplots.ai +"""pyplots.ai heatmap-basic: Basic Heatmap -Library: altair 6.0.0 | Python 3.13.11 -Quality: 91/100 | Created: 2025-12-23 +Library: altair 6.0.0 | Python 3.14.3 +Quality: /100 | Updated: 2026-02-15 """ import altair as alt @@ -9,55 +9,90 @@ import pandas as pd -# Data - create a matrix with patterns +# Data - correlation matrix with realistic variables np.random.seed(42) -rows = ["Row A", "Row B", "Row C", "Row D", "Row E", "Row F", "Row G", "Row H"] -cols = ["Col 1", "Col 2", "Col 3", "Col 4", "Col 5", "Col 6", "Col 7", "Col 8"] +variables = [ + "Temperature", + "Humidity", + "Wind Speed", + "Pressure", + "Visibility", + "Cloud Cover", + "Precipitation", + "UV Index", +] -# Generate values with some patterns (diagonal pattern + noise) -values = [] -for i, row in enumerate(rows): - for j, col in enumerate(cols): - # Create pattern: higher values near diagonal, add noise - base = 100 - abs(i - j) * 12 - noise = np.random.randn() * 10 - values.append({"x": col, "y": row, "value": base + noise}) +n_samples = 200 +raw = np.random.randn(n_samples, len(variables)) -df = pd.DataFrame(values) +# Inject realistic correlations +raw[:, 1] += raw[:, 0] * 0.6 # Humidity ~ Temperature +raw[:, 5] += raw[:, 1] * 0.7 # Cloud Cover ~ Humidity +raw[:, 6] += raw[:, 5] * 0.5 # Precipitation ~ Cloud Cover +raw[:, 4] -= raw[:, 5] * 0.8 # Visibility inversely ~ Cloud Cover +raw[:, 7] -= raw[:, 5] * 0.6 # UV Index inversely ~ Cloud Cover +raw[:, 3] -= raw[:, 0] * 0.3 # Pressure inversely ~ Temperature -# Plot - heatmap base +corr = np.corrcoef(raw.T) + +# Build long-form dataframe +records = [] +for i, row_var in enumerate(variables): + for j, col_var in enumerate(variables): + records.append({"x": col_var, "y": row_var, "value": round(corr[i, j], 2)}) + +df = pd.DataFrame(records) + +# Axis ordering +axis_order = list(variables) + +# Plot - heatmap with diverging color centered at 0 heatmap = ( alt.Chart(df) - .mark_rect() + .mark_rect(stroke="#ffffff", strokeWidth=1.5) .encode( - x=alt.X("x:N", title="Column", axis=alt.Axis(labelFontSize=16, titleFontSize=20)), - y=alt.Y("y:N", title="Row", axis=alt.Axis(labelFontSize=16, titleFontSize=20)), + x=alt.X("x:N", title=None, sort=axis_order, axis=alt.Axis(labelFontSize=16, labelAngle=0, orient="top")), + y=alt.Y("y:N", title=None, sort=axis_order, axis=alt.Axis(labelFontSize=16)), color=alt.Color( "value:Q", - scale=alt.Scale(scheme="blueorange", domainMid=50), - legend=alt.Legend(title="Value", titleFontSize=18, labelFontSize=16), + scale=alt.Scale(scheme="redblue", domain=[-1, 1], domainMid=0), + legend=alt.Legend( + title="Correlation", titleFontSize=18, labelFontSize=16, gradientLength=300, gradientThickness=16 + ), ), - tooltip=["x:N", "y:N", "value:Q"], + tooltip=[ + alt.Tooltip("x:N", title="Variable X"), + alt.Tooltip("y:N", title="Variable Y"), + alt.Tooltip("value:Q", title="Correlation", format=".2f"), + ], ) ) -# Add text annotations +# Text annotations with adaptive color text = ( alt.Chart(df) - .mark_text(fontSize=18) + .mark_text(fontSize=16, fontWeight="bold") .encode( - x=alt.X("x:N"), - y=alt.Y("y:N"), - text=alt.Text("value:Q", format=".0f"), - color=alt.condition(alt.datum.value > 70, alt.value("white"), alt.value("black")), + x=alt.X("x:N", sort=axis_order), + y=alt.Y("y:N", sort=axis_order), + text=alt.Text("value:Q", format=".2f"), + color=alt.when((alt.datum.value > 0.6) | (alt.datum.value < -0.6)) + .then(alt.value("white")) + .otherwise(alt.value("#333333")), ) ) -# Combine heatmap and text, then apply configuration +# Combine and configure chart = ( (heatmap + text) - .properties(width=1400, height=800, title=alt.Title("heatmap-basic · altair · pyplots.ai", fontSize=28)) - .configure_axis(labelFontSize=16, titleFontSize=20, grid=False) + .properties( + width=1200, + height=1200, + title=alt.Title( + "Weather Metrics Correlation · heatmap-basic · altair · pyplots.ai", fontSize=28, anchor="start", offset=20 + ), + ) + .configure_axis(grid=False) .configure_view(strokeWidth=0) ) diff --git a/plots/heatmap-basic/metadata/altair.yaml b/plots/heatmap-basic/metadata/altair.yaml index e518abf054..b26c6a0d88 100644 --- a/plots/heatmap-basic/metadata/altair.yaml +++ b/plots/heatmap-basic/metadata/altair.yaml @@ -1,16 +1,16 @@ library: altair specification_id: heatmap-basic created: '2025-12-23T00:48:16Z' -updated: '2025-12-23T01:21:13Z' -generated_by: claude-opus-4-5-20251101 +updated: '2026-02-15T21:25:00+00:00' +generated_by: claude-opus-4-6 workflow_run: 20447968624 issue: 0 -python_version: 3.13.11 +python_version: 3.14.3 library_version: 6.0.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.html -quality_score: 91 +quality_score: null impl_tags: dependencies: [] techniques: diff --git a/plots/heatmap-basic/specification.md b/plots/heatmap-basic/specification.md index cef917e2dc..4b790ff068 100644 --- a/plots/heatmap-basic/specification.md +++ b/plots/heatmap-basic/specification.md @@ -23,4 +23,4 @@ A heatmap displaying values in a matrix format using color intensity. Each cell' - Use a diverging colormap for data with positive/negative values - Add value annotations in cells when readable - Include a colorbar legend -- Consider clustering rows/columns for better pattern visibility +- Order rows/columns logically (alphabetical, by magnitude, or by similarity) diff --git a/plots/heatmap-basic/specification.yaml b/plots/heatmap-basic/specification.yaml index 8c02cfc6a5..82b0687684 100644 --- a/plots/heatmap-basic/specification.yaml +++ b/plots/heatmap-basic/specification.yaml @@ -6,7 +6,7 @@ title: Basic Heatmap # Specification tracking created: 2025-12-14T09:02:34Z -updated: 2025-12-14T09:02:34Z +updated: 2026-02-15T12:00:00Z issue: 691 suggested: MarkusNeusinger @@ -18,6 +18,7 @@ tags: data_type: - numeric - categorical + - matrix domain: - statistics - general From 55568e88150b3a7b33b07190aa4db6cd54a18134 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Feb 2026 21:31:02 +0000 Subject: [PATCH 2/8] chore(altair): update quality score 85 and review feedback for heatmap-basic --- plots/heatmap-basic/implementations/altair.py | 4 +- plots/heatmap-basic/metadata/altair.yaml | 263 ++++++++++-------- 2 files changed, 149 insertions(+), 118 deletions(-) diff --git a/plots/heatmap-basic/implementations/altair.py b/plots/heatmap-basic/implementations/altair.py index f03453e846..166129dfbb 100644 --- a/plots/heatmap-basic/implementations/altair.py +++ b/plots/heatmap-basic/implementations/altair.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai heatmap-basic: Basic Heatmap Library: altair 6.0.0 | Python 3.14.3 -Quality: /100 | Updated: 2026-02-15 +Quality: 85/100 | Updated: 2026-02-15 """ import altair as alt diff --git a/plots/heatmap-basic/metadata/altair.yaml b/plots/heatmap-basic/metadata/altair.yaml index b26c6a0d88..e47bb2715c 100644 --- a/plots/heatmap-basic/metadata/altair.yaml +++ b/plots/heatmap-basic/metadata/altair.yaml @@ -1,7 +1,7 @@ library: altair specification_id: heatmap-basic created: '2025-12-23T00:48:16Z' -updated: '2026-02-15T21:25:00+00:00' +updated: '2026-02-15T21:31:02Z' generated_by: claude-opus-4-6 workflow_run: 20447968624 issue: 0 @@ -10,156 +10,180 @@ library_version: 6.0.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.html -quality_score: null +quality_score: 85 impl_tags: dependencies: [] techniques: - - colorbar - annotations - - html-export - layer-composition + - hover-tooltips + - html-export patterns: - data-generation - dataprep: [] - styling: [] + - iteration-over-groups + dataprep: + - correlation-matrix + styling: + - custom-colormap + - edge-highlighting review: strengths: - - Excellent use of diverging colormap (blueorange) with domainMid=50 to center the - color scale - - Smart conditional text coloring (white on dark cells, black on light cells) for - optimal readability - - Clean declarative Altair syntax combining heatmap + text layers - - Proper use of tooltips for interactivity in HTML export - - Well-proportioned 8x8 matrix with clear diagonal pattern demonstrating heatmap - utility + - Excellent use of Altair declarative API with layer composition (heatmap + text) + for annotations + - Adaptive text color via alt.when().then().otherwise() conditional encoding — a + distinctive Altair 5.x+ feature + - Realistic weather correlation data with injected correlations producing meaningful + patterns + - Clean KISS code structure with appropriate complexity + - White cell borders add visual polish and separation + - Interactive tooltips and HTML export leverage Altair interactive capabilities weaknesses: - - Data could include negative values to fully showcase the diverging colormap potential - - Generic row/column labels (Row A, Col 1) could be more realistic (e.g., correlation - matrix with variable names) - - X-axis labels appear slightly rotated which is unnecessary for short labels - image_description: The plot displays an 8x8 heatmap with rows labeled "Row A" through - "Row H" and columns labeled "Col 1" through "Col 8". The colormap uses a blue-orange - diverging scheme (blueorange) with blue representing low values (~8-25) and orange/brown - representing high values (~100-110). Each cell displays its numeric value as text - annotation - white text on dark cells and black text on light cells. A clear diagonal - pattern is visible with higher values along the main diagonal descending from - top-left to bottom-right. The title "heatmap-basic · altair · pyplots.ai" appears - at the top. A vertical colorbar legend labeled "Value" shows the scale from approximately - 20 to 100. + - Color scheme redblue is not ideal for colorblind accessibility — consider switching + to blueorange or a perceptually-uniform diverging scheme + - Title prepends Weather Metrics Correlation before the required format — should + be exactly heatmap-basic · altair · pyplots.ai + - Layout has some wasted space especially around the colorbar area on the right + side + - No explicit visual emphasis or storytelling beyond the diverging color — strongest + correlations could be highlighted more prominently + - Axis titles are set to None; even for a correlation matrix a subtle axis label + or subtitle could provide context + image_description: The plot displays an 8x8 correlation heatmap of weather metrics + (Temperature, Humidity, Wind Speed, Pressure, Visibility, Cloud Cover, Precipitation, + UV Index). A diverging blue-white-red color scheme is used, centered at zero — + dark blue represents strong positive correlations (e.g., diagonal = 1.00) and + dark red represents strong negative correlations (e.g., Visibility vs Cloud Cover + = -0.73). Each cell contains a bold numeric annotation showing the correlation + coefficient to two decimal places. Text color adapts — white on saturated cells, + dark gray on lighter cells. X-axis labels appear at the top, Y-axis labels on + the left. White borders separate cells cleanly. A vertical colorbar on the right + labeled "Correlation" ranges from -1.0 to 1.0. The title reads "Weather Metrics + Correlation · heatmap-basic · altair · pyplots.ai" at the top-left. The overall + layout is square (3600x3600 px). criteria_checklist: visual_quality: - score: 36 - max: 40 + score: 25 + max: 30 items: - id: VQ-01 name: Text Legibility - score: 10 - max: 10 + score: 8 + max: 8 passed: true - comment: Title at 28pt, axis labels at 16-20pt, annotations at 18pt - all - perfectly readable + comment: 'All font sizes explicitly set: title 28pt, axis labels 16pt, annotations + 16pt bold, legend title 18pt/labels 16pt' - id: VQ-02 name: No Overlap - score: 8 - max: 8 + score: 6 + max: 6 passed: true - comment: No overlapping text anywhere + comment: No overlapping text anywhere, cells well-sized for annotations - id: VQ-03 name: Element Visibility - score: 8 - max: 8 + score: 6 + max: 6 passed: true - comment: Cells well-sized, clear color differentiation + comment: Cells optimally sized for 8x8 matrix with white border separation - id: VQ-04 name: Color Accessibility - score: 4 - max: 5 - passed: true - comment: Blue-orange diverging scheme is colorblind-safe, good choice + score: 2 + max: 4 + passed: false + comment: redblue scheme problematic for red-green colorblind users; blueorange + or brownbluegreen would be more accessible - id: VQ-05 - name: Layout Balance - score: 4 - max: 5 - passed: true - comment: Good proportions, slight whitespace around edges + name: Layout & Canvas + score: 2 + max: 4 + passed: false + comment: Square layout suits correlation matrix but some wasted space near + colorbar, slightly unbalanced - id: VQ-06 - name: Axis Labels + name: Axis Labels & Title score: 1 max: 2 + passed: false + comment: Axis titles set to None; variable names are descriptive but no axis + title context provided + design_excellence: + score: 13 + max: 20 + items: + - id: DE-01 + name: Aesthetic Sophistication + score: 6 + max: 8 passed: true - comment: '"Column" and "Row" are descriptive but generic (no units expected - for this type)' - - id: VQ-07 - name: Grid & Legend - score: 1 - max: 2 + comment: 'Strong design: diverging palette effective, white cell borders add + polish, clean typography hierarchy' + - id: DE-02 + name: Visual Refinement + score: 4 + max: 6 passed: true - comment: Colorbar present and well-placed, no grid needed for heatmap (cells - serve as grid) + comment: Grid disabled, view stroke removed, explicit font sizing, white cell + borders + - id: DE-03 + name: Data Storytelling + score: 3 + max: 6 + passed: false + comment: Meaningful correlation patterns created but no explicit visual emphasis + on strongest correlations beyond color spec_compliance: - score: 25 - max: 25 + score: 14 + max: 15 items: - id: SC-01 name: Plot Type - score: 8 - max: 8 - passed: true - comment: Correct heatmap using mark_rect() - - id: SC-02 - name: Data Mapping score: 5 max: 5 passed: true - comment: X/Y correctly assigned to columns/rows, value to color - - id: SC-03 + comment: 'Correct chart type: heatmap via mark_rect()' + - id: SC-02 name: Required Features - score: 5 - max: 5 + score: 4 + max: 4 passed: true - comment: Matrix format, color intensity, diverging colormap with domainMid, - value annotations, colorbar legend all present - - id: SC-04 - name: Data Range + comment: 'All spec features present: diverging colormap, value annotations, + colorbar, logical ordering' + - id: SC-03 + name: Data Mapping score: 3 max: 3 passed: true - comment: All values visible within scale - - id: SC-05 - name: Legend Accuracy - score: 2 - max: 2 - passed: true - comment: Legend title "Value" is accurate - - id: SC-06 - name: Title Format + comment: X/Y correctly assigned, all 64 cells visible + - id: SC-04 + name: Title & Legend score: 2 - max: 2 - passed: true - comment: Uses correct format "heatmap-basic · altair · pyplots.ai" + max: 3 + passed: false + comment: Title prepends Weather Metrics Correlation before required format; + legend label Correlation is appropriate data_quality: - score: 17 - max: 20 + score: 14 + max: 15 items: - id: DQ-01 name: Feature Coverage - score: 6 - max: 8 + score: 5 + max: 6 passed: true - comment: Shows diagonal pattern and value variation well, but lacks negative - values to fully demonstrate diverging colormap + comment: Shows positive, negative, near-zero correlations and perfect diagonal; + good range - id: DQ-02 name: Realistic Context - score: 6 - max: 7 + score: 5 + max: 5 passed: true - comment: Generic row/column labels, plausible but not real-world scenario + comment: Weather metrics correlation is realistic, neutral, scientifically + meaningful - id: DQ-03 name: Appropriate Scale - score: 5 - max: 5 + score: 4 + max: 4 passed: true - comment: Values 8-110 are sensible for demonstration + comment: Correlation values properly bounded [-1, 1] with realistic magnitudes code_quality: score: 10 max: 10 @@ -169,40 +193,47 @@ review: score: 3 max: 3 passed: true - comment: Clean imports → data → plot → save structure, no functions/classes + comment: 'Clean flow: imports, data generation, plot, save' - id: CQ-02 name: Reproducibility - score: 3 - max: 3 + score: 2 + max: 2 passed: true - comment: np.random.seed(42) set + comment: np.random.seed(42) used - id: CQ-03 name: Clean Imports score: 2 max: 2 passed: true - comment: All imports are used + comment: All imports (altair, numpy, pandas) are used - id: CQ-04 - name: No Deprecated API - score: 1 - max: 1 + name: Code Elegance + score: 2 + max: 2 passed: true - comment: Current Altair API used + comment: Clean, well-structured, appropriate complexity - id: CQ-05 - name: Output Correct + name: Output & API score: 1 max: 1 passed: true - comment: Saves as plot.png and plot.html + comment: Saves as plot.png and plot.html, no deprecated APIs library_features: - score: 3 - max: 5 + score: 9 + max: 10 items: - - id: LF-01 - name: Uses distinctive library features - score: 3 + - id: LM-01 + name: Idiomatic Usage + score: 5 + max: 5 + passed: true + comment: 'Expertly uses Altair declarative grammar: encoding types, alt.Scale, + alt.Legend, alt.Title, alt.Tooltip, layer composition' + - id: LM-02 + name: Distinctive Features + score: 4 max: 5 passed: true - comment: Uses alt.condition for text color, tooltip encoding, scale with domainMid, - but could use more interactive features - verdict: APPROVED + comment: Uses alt.when().then().otherwise() conditional encoding for adaptive + text color (Altair 5.x+ feature), tooltips, HTML export + verdict: REJECTED From 36602ce2d89ee311c1e27dd7f7b4370f20c1cfda Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Feb 2026 21:35:49 +0000 Subject: [PATCH 3/8] fix(altair): address review feedback for heatmap-basic Attempt 1/3 - fixes based on AI review --- plots/heatmap-basic/implementations/altair.py | 66 ++++++++++++++----- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/plots/heatmap-basic/implementations/altair.py b/plots/heatmap-basic/implementations/altair.py index 166129dfbb..88a54f4dc3 100644 --- a/plots/heatmap-basic/implementations/altair.py +++ b/plots/heatmap-basic/implementations/altair.py @@ -1,4 +1,4 @@ -""" pyplots.ai +"""pyplots.ai heatmap-basic: Basic Heatmap Library: altair 6.0.0 | Python 3.14.3 Quality: 85/100 | Updated: 2026-02-15 @@ -25,13 +25,15 @@ n_samples = 200 raw = np.random.randn(n_samples, len(variables)) -# Inject realistic correlations +# Inject realistic correlations with stronger relationships raw[:, 1] += raw[:, 0] * 0.6 # Humidity ~ Temperature raw[:, 5] += raw[:, 1] * 0.7 # Cloud Cover ~ Humidity -raw[:, 6] += raw[:, 5] * 0.5 # Precipitation ~ Cloud Cover -raw[:, 4] -= raw[:, 5] * 0.8 # Visibility inversely ~ Cloud Cover -raw[:, 7] -= raw[:, 5] * 0.6 # UV Index inversely ~ Cloud Cover -raw[:, 3] -= raw[:, 0] * 0.3 # Pressure inversely ~ Temperature +raw[:, 6] += raw[:, 5] * 0.65 # Precipitation ~ Cloud Cover (stronger) +raw[:, 4] -= raw[:, 5] * 0.9 # Visibility inversely ~ Cloud Cover (stronger) +raw[:, 7] -= raw[:, 5] * 0.7 # UV Index inversely ~ Cloud Cover (stronger) +raw[:, 7] += raw[:, 0] * 0.5 # UV Index ~ Temperature +raw[:, 3] -= raw[:, 0] * 0.4 # Pressure inversely ~ Temperature (stronger) +raw[:, 2] += raw[:, 3] * 0.3 # Wind Speed ~ Pressure corr = np.corrcoef(raw.T) @@ -39,25 +41,44 @@ records = [] for i, row_var in enumerate(variables): for j, col_var in enumerate(variables): - records.append({"x": col_var, "y": row_var, "value": round(corr[i, j], 2)}) + val = round(corr[i, j], 2) + records.append({"x": col_var, "y": row_var, "value": val, "abs_value": abs(val)}) df = pd.DataFrame(records) # Axis ordering axis_order = list(variables) -# Plot - heatmap with diverging color centered at 0 +# Plot - heatmap with colorblind-safe diverging color centered at 0 heatmap = ( alt.Chart(df) - .mark_rect(stroke="#ffffff", strokeWidth=1.5) + .mark_rect(stroke="#ffffff", strokeWidth=1.5, cornerRadius=2) .encode( - x=alt.X("x:N", title=None, sort=axis_order, axis=alt.Axis(labelFontSize=16, labelAngle=0, orient="top")), - y=alt.Y("y:N", title=None, sort=axis_order, axis=alt.Axis(labelFontSize=16)), + x=alt.X( + "x:N", + title="Weather Variable", + sort=axis_order, + axis=alt.Axis( + labelFontSize=16, labelAngle=-30, orient="top", titleFontSize=20, titlePadding=12, labelPadding=8 + ), + ), + y=alt.Y( + "y:N", + title="Weather Variable", + sort=axis_order, + axis=alt.Axis(labelFontSize=16, titleFontSize=20, titlePadding=12, labelPadding=8), + ), color=alt.Color( "value:Q", - scale=alt.Scale(scheme="redblue", domain=[-1, 1], domainMid=0), + scale=alt.Scale(scheme="blueorange", domain=[-1, 1], domainMid=0), legend=alt.Legend( - title="Correlation", titleFontSize=18, labelFontSize=16, gradientLength=300, gradientThickness=16 + title="Correlation", + titleFontSize=18, + labelFontSize=16, + gradientLength=350, + gradientThickness=18, + titlePadding=8, + offset=12, ), ), tooltip=[ @@ -68,6 +89,13 @@ ) ) +# Highlight cells with strong correlations using thicker borders +highlight = ( + alt.Chart(df[df["abs_value"] >= 0.7]) + .mark_rect(stroke="#333333", strokeWidth=2.5, filled=False, cornerRadius=2) + .encode(x=alt.X("x:N", sort=axis_order), y=alt.Y("y:N", sort=axis_order)) +) + # Text annotations with adaptive color text = ( alt.Chart(df) @@ -76,7 +104,7 @@ x=alt.X("x:N", sort=axis_order), y=alt.Y("y:N", sort=axis_order), text=alt.Text("value:Q", format=".2f"), - color=alt.when((alt.datum.value > 0.6) | (alt.datum.value < -0.6)) + color=alt.when((alt.datum.value > 0.55) | (alt.datum.value < -0.55)) .then(alt.value("white")) .otherwise(alt.value("#333333")), ) @@ -84,12 +112,18 @@ # Combine and configure chart = ( - (heatmap + text) + (heatmap + highlight + text) .properties( width=1200, height=1200, title=alt.Title( - "Weather Metrics Correlation · heatmap-basic · altair · pyplots.ai", fontSize=28, anchor="start", offset=20 + "heatmap-basic · altair · pyplots.ai", + subtitle="Pairwise Pearson correlation coefficients for 8 weather metrics", + fontSize=28, + subtitleFontSize=18, + subtitleColor="#666666", + anchor="start", + offset=20, ), ) .configure_axis(grid=False) From 1772b2e3991ac53407b79b87e9bb3d7fc75ca3b4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Feb 2026 21:39:54 +0000 Subject: [PATCH 4/8] chore(altair): update quality score 87 and review feedback for heatmap-basic --- plots/heatmap-basic/implementations/altair.py | 4 +- plots/heatmap-basic/metadata/altair.yaml | 161 +++++++++--------- 2 files changed, 83 insertions(+), 82 deletions(-) diff --git a/plots/heatmap-basic/implementations/altair.py b/plots/heatmap-basic/implementations/altair.py index 88a54f4dc3..021746d641 100644 --- a/plots/heatmap-basic/implementations/altair.py +++ b/plots/heatmap-basic/implementations/altair.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai heatmap-basic: Basic Heatmap Library: altair 6.0.0 | Python 3.14.3 -Quality: 85/100 | Updated: 2026-02-15 +Quality: 87/100 | Updated: 2026-02-15 """ import altair as alt diff --git a/plots/heatmap-basic/metadata/altair.yaml b/plots/heatmap-basic/metadata/altair.yaml index e47bb2715c..320dfdb413 100644 --- a/plots/heatmap-basic/metadata/altair.yaml +++ b/plots/heatmap-basic/metadata/altair.yaml @@ -1,7 +1,7 @@ library: altair specification_id: heatmap-basic created: '2025-12-23T00:48:16Z' -updated: '2026-02-15T21:31:02Z' +updated: '2026-02-15T21:39:54Z' generated_by: claude-opus-4-6 workflow_run: 20447968624 issue: 0 @@ -10,7 +10,7 @@ library_version: 6.0.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.html -quality_score: 85 +quality_score: 87 impl_tags: dependencies: [] techniques: @@ -28,41 +28,42 @@ impl_tags: - edge-highlighting review: strengths: - - Excellent use of Altair declarative API with layer composition (heatmap + text) - for annotations - - Adaptive text color via alt.when().then().otherwise() conditional encoding — a - distinctive Altair 5.x+ feature - - Realistic weather correlation data with injected correlations producing meaningful - patterns - - Clean KISS code structure with appropriate complexity - - White cell borders add visual polish and separation - - Interactive tooltips and HTML export leverage Altair interactive capabilities + - Excellent use of Altair conditional encoding (alt.when().then().otherwise()) for + adaptive text color — distinctively Altair feature that enhances readability + - Strong-correlation border highlighting (dark borders on |r| >= 0.7) adds meaningful + visual hierarchy and guides reader to important relationships + - Well-crafted data with realistic injected correlations creating a believable weather + scenario with both positive and negative relationships + - White cell borders with rounded corners and clean grid-free design create a polished + modern look + - Informative subtitle contextualizes the data being displayed weaknesses: - - Color scheme redblue is not ideal for colorblind accessibility — consider switching - to blueorange or a perceptually-uniform diverging scheme - - Title prepends Weather Metrics Correlation before the required format — should - be exactly heatmap-basic · altair · pyplots.ai - - Layout has some wasted space especially around the colorbar area on the right - side - - No explicit visual emphasis or storytelling beyond the diverging color — strongest - correlations could be highlighted more prominently - - Axis titles are set to None; even for a correlation matrix a subtle axis label - or subtitle could provide context - image_description: The plot displays an 8x8 correlation heatmap of weather metrics - (Temperature, Humidity, Wind Speed, Pressure, Visibility, Cloud Cover, Precipitation, - UV Index). A diverging blue-white-red color scheme is used, centered at zero — - dark blue represents strong positive correlations (e.g., diagonal = 1.00) and - dark red represents strong negative correlations (e.g., Visibility vs Cloud Cover - = -0.73). Each cell contains a bold numeric annotation showing the correlation - coefficient to two decimal places. Text color adapts — white on saturated cells, - dark gray on lighter cells. X-axis labels appear at the top, Y-axis labels on - the left. White borders separate cells cleanly. A vertical colorbar on the right - labeled "Correlation" ranges from -1.0 to 1.0. The title reads "Weather Metrics - Correlation · heatmap-basic · altair · pyplots.ai" at the top-left. The overall - layout is square (3600x3600 px). + - Canvas utilization could be improved — noticeable empty space around the heatmap, + and the colorbar legend floats somewhat isolated to the right + - Both axes labeled Weather Variable is redundant — consider differentiating or + removing one axis title + - Aesthetic sophistication could be elevated with more refined design choices (e.g., + subtle background tint, more intentional spacing) to push DE-01 from 6 to 7-8 + - Minor label cramping on some angled x-axis labels at the edges + image_description: 'The plot displays an 8x8 pairwise Pearson correlation matrix + heatmap for weather variables: Temperature, Humidity, Wind Speed, Pressure, Visibility, + Cloud Cover, Precipitation, and UV Index. The color scheme uses a blue-orange + diverging palette (Altair''s "blueorange") centered at 0, where orange/brown indicates + positive correlations and blue indicates negative correlations. Each cell contains + a numeric annotation showing the correlation coefficient to two decimal places. + Cells with strong correlations (|r| >= 0.7) are highlighted with darker borders. + Text color adapts — white on dark cells, dark gray on light cells. The diagonal + shows 1.00 values. X-axis labels are positioned at the top at a -30 degree angle; + Y-axis labels are on the left. Both axes are labeled "Weather Variable." A vertical + color gradient legend labeled "Correlation" appears on the right side ranging + from -1.0 to 1.0. The title reads "heatmap-basic · altair · pyplots.ai" with subtitle + "Pairwise Pearson correlation coefficients for 8 weather metrics." White cell + borders with rounded corners separate the cells. Notable correlations include + Cloud Cover and Visibility (-0.77), Cloud Cover and Precipitation (0.63), and + Humidity and Cloud Cover (0.54).' criteria_checklist: visual_quality: - score: 25 + score: 26 max: 30 items: - id: VQ-01 @@ -70,43 +71,43 @@ review: score: 8 max: 8 passed: true - comment: 'All font sizes explicitly set: title 28pt, axis labels 16pt, annotations - 16pt bold, legend title 18pt/labels 16pt' + comment: 'All font sizes explicitly set: title 28pt, axis title 20pt, tick + labels 16pt, annotations 16pt bold, legend title 18pt, legend labels 16pt' - id: VQ-02 name: No Overlap - score: 6 + score: 5 max: 6 passed: true - comment: No overlapping text anywhere, cells well-sized for annotations + comment: X-axis labels angled at -30 degrees mostly avoid overlap but slight + cramping on end labels - id: VQ-03 name: Element Visibility score: 6 max: 6 passed: true - comment: Cells optimally sized for 8x8 matrix with white border separation + comment: All 64 cells clearly visible with strong color differentiation - id: VQ-04 name: Color Accessibility - score: 2 + score: 4 max: 4 - passed: false - comment: redblue scheme problematic for red-green colorblind users; blueorange - or brownbluegreen would be more accessible + passed: true + comment: Blue-orange diverging scheme is colorblind-safe with good contrast - id: VQ-05 name: Layout & Canvas score: 2 max: 4 passed: false - comment: Square layout suits correlation matrix but some wasted space near - colorbar, slightly unbalanced + comment: Noticeable empty space around heatmap, colorbar legend somewhat isolated + to the right - id: VQ-06 name: Axis Labels & Title score: 1 max: 2 passed: false - comment: Axis titles set to None; variable names are descriptive but no axis - title context provided + comment: Weather Variable is descriptive but redundant on both axes, no units + (though not applicable for correlation) design_excellence: - score: 13 + score: 14 max: 20 items: - id: DE-01 @@ -114,24 +115,25 @@ review: score: 6 max: 8 passed: true - comment: 'Strong design: diverging palette effective, white cell borders add - polish, clean typography hierarchy' + comment: Strong design with blue-orange scheme, white cell borders with rounded + corners, border highlighting, adaptive text color. Above defaults but not + publication-level. - id: DE-02 name: Visual Refinement score: 4 max: 6 passed: true - comment: Grid disabled, view stroke removed, explicit font sizing, white cell - borders + comment: Grid removed, view stroke removed, white cell borders, rounded corners, + generous padding. Good refinement visible. - id: DE-03 name: Data Storytelling - score: 3 + score: 4 max: 6 - passed: false - comment: Meaningful correlation patterns created but no explicit visual emphasis - on strongest correlations beyond color + passed: true + comment: Strong-correlation highlighting creates visual hierarchy. Correlation + clusters visible. Subtitle provides context. spec_compliance: - score: 14 + score: 15 max: 15 items: - id: SC-01 @@ -139,27 +141,26 @@ review: score: 5 max: 5 passed: true - comment: 'Correct chart type: heatmap via mark_rect()' + comment: Correct heatmap using mark_rect() - id: SC-02 name: Required Features score: 4 max: 4 passed: true comment: 'All spec features present: diverging colormap, value annotations, - colorbar, logical ordering' + colorbar legend, logical ordering' - id: SC-03 name: Data Mapping score: 3 max: 3 passed: true - comment: X/Y correctly assigned, all 64 cells visible + comment: X/Y correctly mapped as column/row variables - id: SC-04 name: Title & Legend - score: 2 + score: 3 max: 3 - passed: false - comment: Title prepends Weather Metrics Correlation before required format; - legend label Correlation is appropriate + passed: true + comment: Title format correct, colorbar legend labeled Correlation data_quality: score: 14 max: 15 @@ -169,23 +170,22 @@ review: score: 5 max: 6 passed: true - comment: Shows positive, negative, near-zero correlations and perfect diagonal; - good range + comment: Shows positive, negative, and near-zero correlations. Diagonal 1.00 + values. Good range but could have stronger negatives. - id: DQ-02 name: Realistic Context score: 5 max: 5 passed: true - comment: Weather metrics correlation is realistic, neutral, scientifically - meaningful + comment: Weather metrics correlation is a real, neutral, comprehensible scenario - id: DQ-03 name: Appropriate Scale score: 4 max: 4 passed: true - comment: Correlation values properly bounded [-1, 1] with realistic magnitudes + comment: All values in [-1, 1] range, realistic for weather data correlations code_quality: - score: 10 + score: 9 max: 10 items: - id: CQ-01 @@ -193,25 +193,26 @@ review: score: 3 max: 3 passed: true - comment: 'Clean flow: imports, data generation, plot, save' + comment: 'Clean flow: imports, data generation, plot, save. No functions/classes.' - id: CQ-02 name: Reproducibility score: 2 max: 2 passed: true - comment: np.random.seed(42) used + comment: np.random.seed(42) set - id: CQ-03 name: Clean Imports score: 2 max: 2 passed: true - comment: All imports (altair, numpy, pandas) are used + comment: All imports used (altair, numpy, pandas) - id: CQ-04 name: Code Elegance - score: 2 + score: 1 max: 2 - passed: true - comment: Clean, well-structured, appropriate complexity + passed: false + comment: 'Slightly verbose: abs_value column only used for highlight filter, + records list-append loop could be more concise' - id: CQ-05 name: Output & API score: 1 @@ -227,13 +228,13 @@ review: score: 5 max: 5 passed: true - comment: 'Expertly uses Altair declarative grammar: encoding types, alt.Scale, - alt.Legend, alt.Title, alt.Tooltip, layer composition' + comment: 'Expert use of Altair declarative grammar: proper encoding types, + alt.X/Y with axis config, alt.Color with Scale, alt.Legend, alt.Title' - id: LM-02 name: Distinctive Features score: 4 max: 5 passed: true - comment: Uses alt.when().then().otherwise() conditional encoding for adaptive - text color (Altair 5.x+ feature), tooltips, HTML export + comment: 'Uses Altair-specific features: layer composition, alt.when().then().otherwise() + conditional encoding, tooltip encoding, declarative mark composition' verdict: REJECTED From e60613317611705c22f2fd1af3bbc5b5ce82eb78 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Feb 2026 21:45:18 +0000 Subject: [PATCH 5/8] fix(altair): address review feedback for heatmap-basic Attempt 2/3 - fixes based on AI review --- plots/heatmap-basic/implementations/altair.py | 90 +++++++++---------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/plots/heatmap-basic/implementations/altair.py b/plots/heatmap-basic/implementations/altair.py index 021746d641..6f5481f9ec 100644 --- a/plots/heatmap-basic/implementations/altair.py +++ b/plots/heatmap-basic/implementations/altair.py @@ -1,4 +1,4 @@ -""" pyplots.ai +"""pyplots.ai heatmap-basic: Basic Heatmap Library: altair 6.0.0 | Python 3.14.3 Quality: 87/100 | Updated: 2026-02-15 @@ -9,7 +9,7 @@ import pandas as pd -# Data - correlation matrix with realistic variables +# Data - correlation matrix with realistic weather variables np.random.seed(42) variables = [ "Temperature", @@ -28,23 +28,23 @@ # Inject realistic correlations with stronger relationships raw[:, 1] += raw[:, 0] * 0.6 # Humidity ~ Temperature raw[:, 5] += raw[:, 1] * 0.7 # Cloud Cover ~ Humidity -raw[:, 6] += raw[:, 5] * 0.65 # Precipitation ~ Cloud Cover (stronger) -raw[:, 4] -= raw[:, 5] * 0.9 # Visibility inversely ~ Cloud Cover (stronger) -raw[:, 7] -= raw[:, 5] * 0.7 # UV Index inversely ~ Cloud Cover (stronger) +raw[:, 6] += raw[:, 5] * 0.65 # Precipitation ~ Cloud Cover +raw[:, 4] -= raw[:, 5] * 0.9 # Visibility inversely ~ Cloud Cover +raw[:, 7] -= raw[:, 5] * 0.7 # UV Index inversely ~ Cloud Cover raw[:, 7] += raw[:, 0] * 0.5 # UV Index ~ Temperature -raw[:, 3] -= raw[:, 0] * 0.4 # Pressure inversely ~ Temperature (stronger) +raw[:, 3] -= raw[:, 0] * 0.4 # Pressure inversely ~ Temperature raw[:, 2] += raw[:, 3] * 0.3 # Wind Speed ~ Pressure corr = np.corrcoef(raw.T) -# Build long-form dataframe -records = [] -for i, row_var in enumerate(variables): - for j, col_var in enumerate(variables): - val = round(corr[i, j], 2) - records.append({"x": col_var, "y": row_var, "value": val, "abs_value": abs(val)}) - -df = pd.DataFrame(records) +# Build long-form dataframe using list comprehension +df = pd.DataFrame( + [ + {"Row": row_var, "Column": col_var, "value": round(corr[i, j], 2)} + for i, row_var in enumerate(variables) + for j, col_var in enumerate(variables) + ] +) # Axis ordering axis_order = list(variables) @@ -55,35 +55,29 @@ .mark_rect(stroke="#ffffff", strokeWidth=1.5, cornerRadius=2) .encode( x=alt.X( - "x:N", - title="Weather Variable", - sort=axis_order, - axis=alt.Axis( - labelFontSize=16, labelAngle=-30, orient="top", titleFontSize=20, titlePadding=12, labelPadding=8 - ), - ), - y=alt.Y( - "y:N", - title="Weather Variable", + "Column:N", + title=None, sort=axis_order, - axis=alt.Axis(labelFontSize=16, titleFontSize=20, titlePadding=12, labelPadding=8), + axis=alt.Axis(labelFontSize=15, labelAngle=-35, orient="top", labelPadding=6), ), + y=alt.Y("Row:N", title=None, sort=axis_order, axis=alt.Axis(labelFontSize=15, labelPadding=6)), color=alt.Color( "value:Q", scale=alt.Scale(scheme="blueorange", domain=[-1, 1], domainMid=0), legend=alt.Legend( title="Correlation", - titleFontSize=18, - labelFontSize=16, - gradientLength=350, - gradientThickness=18, - titlePadding=8, - offset=12, + titleFontSize=16, + labelFontSize=14, + gradientLength=300, + gradientThickness=16, + titlePadding=6, + offset=8, + direction="vertical", ), ), tooltip=[ - alt.Tooltip("x:N", title="Variable X"), - alt.Tooltip("y:N", title="Variable Y"), + alt.Tooltip("Column:N", title="Column"), + alt.Tooltip("Row:N", title="Row"), alt.Tooltip("value:Q", title="Correlation", format=".2f"), ], ) @@ -91,45 +85,47 @@ # Highlight cells with strong correlations using thicker borders highlight = ( - alt.Chart(df[df["abs_value"] >= 0.7]) - .mark_rect(stroke="#333333", strokeWidth=2.5, filled=False, cornerRadius=2) - .encode(x=alt.X("x:N", sort=axis_order), y=alt.Y("y:N", sort=axis_order)) + alt.Chart(df) + .transform_filter((alt.datum.value >= 0.7) | (alt.datum.value <= -0.7)) + .mark_rect(stroke="#2a2a2a", strokeWidth=2.5, filled=False, cornerRadius=2) + .encode(x=alt.X("Column:N", sort=axis_order), y=alt.Y("Row:N", sort=axis_order)) ) # Text annotations with adaptive color text = ( alt.Chart(df) - .mark_text(fontSize=16, fontWeight="bold") + .mark_text(fontSize=15, fontWeight="bold") .encode( - x=alt.X("x:N", sort=axis_order), - y=alt.Y("y:N", sort=axis_order), + x=alt.X("Column:N", sort=axis_order), + y=alt.Y("Row:N", sort=axis_order), text=alt.Text("value:Q", format=".2f"), color=alt.when((alt.datum.value > 0.55) | (alt.datum.value < -0.55)) - .then(alt.value("white")) + .then(alt.value("#ffffff")) .otherwise(alt.value("#333333")), ) ) -# Combine and configure +# Combine layers and configure chart = ( (heatmap + highlight + text) .properties( - width=1200, - height=1200, + width=700, + height=730, title=alt.Title( "heatmap-basic · altair · pyplots.ai", subtitle="Pairwise Pearson correlation coefficients for 8 weather metrics", - fontSize=28, - subtitleFontSize=18, + fontSize=26, + subtitleFontSize=16, subtitleColor="#666666", anchor="start", - offset=20, + offset=16, ), + padding={"left": 10, "right": 10, "top": 10, "bottom": 10}, ) .configure_axis(grid=False) .configure_view(strokeWidth=0) ) # Save -chart.save("plot.png", scale_factor=3.0) +chart.save("plot.png", scale_factor=4.0) chart.save("plot.html") From bb1e45a807589e10bc76cb336fc3cb71d649a340 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Feb 2026 21:49:09 +0000 Subject: [PATCH 6/8] chore(altair): update quality score 89 and review feedback for heatmap-basic --- plots/heatmap-basic/implementations/altair.py | 4 +- plots/heatmap-basic/metadata/altair.yaml | 146 +++++++++--------- 2 files changed, 71 insertions(+), 79 deletions(-) diff --git a/plots/heatmap-basic/implementations/altair.py b/plots/heatmap-basic/implementations/altair.py index 6f5481f9ec..c973c9b307 100644 --- a/plots/heatmap-basic/implementations/altair.py +++ b/plots/heatmap-basic/implementations/altair.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai heatmap-basic: Basic Heatmap Library: altair 6.0.0 | Python 3.14.3 -Quality: 87/100 | Updated: 2026-02-15 +Quality: 89/100 | Updated: 2026-02-15 """ import altair as alt diff --git a/plots/heatmap-basic/metadata/altair.yaml b/plots/heatmap-basic/metadata/altair.yaml index 320dfdb413..8bc46644d3 100644 --- a/plots/heatmap-basic/metadata/altair.yaml +++ b/plots/heatmap-basic/metadata/altair.yaml @@ -1,7 +1,7 @@ library: altair specification_id: heatmap-basic created: '2025-12-23T00:48:16Z' -updated: '2026-02-15T21:39:54Z' +updated: '2026-02-15T21:49:09Z' generated_by: claude-opus-4-6 workflow_run: 20447968624 issue: 0 @@ -10,7 +10,7 @@ library_version: 6.0.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.html -quality_score: 87 +quality_score: 89 impl_tags: dependencies: [] techniques: @@ -20,7 +20,6 @@ impl_tags: - html-export patterns: - data-generation - - iteration-over-groups dataprep: - correlation-matrix styling: @@ -28,39 +27,35 @@ impl_tags: - edge-highlighting review: strengths: - - Excellent use of Altair conditional encoding (alt.when().then().otherwise()) for - adaptive text color — distinctively Altair feature that enhances readability - - Strong-correlation border highlighting (dark borders on |r| >= 0.7) adds meaningful - visual hierarchy and guides reader to important relationships - - Well-crafted data with realistic injected correlations creating a believable weather - scenario with both positive and negative relationships - - White cell borders with rounded corners and clean grid-free design create a polished - modern look - - Informative subtitle contextualizes the data being displayed + - Adaptive text color using alt.when() conditional encoding — white on dark cells, + dark on light cells — excellent readability + - Highlight borders on strong correlations (|r| >= 0.7) via transform_filter create + clear visual hierarchy + - Realistic weather correlation data with plausible injected relationships showing + variety of positive and negative correlations + - Clean layered composition (heatmap + highlight + text) is idiomatic Altair + - White cell separators with corner radius give a polished, modern appearance weaknesses: - - Canvas utilization could be improved — noticeable empty space around the heatmap, - and the colorbar legend floats somewhat isolated to the right - - Both axes labeled Weather Variable is redundant — consider differentiating or - removing one axis title - - Aesthetic sophistication could be elevated with more refined design choices (e.g., - subtle background tint, more intentional spacing) to push DE-01 from 6 to 7-8 - - Minor label cramping on some angled x-axis labels at the edges - image_description: 'The plot displays an 8x8 pairwise Pearson correlation matrix - heatmap for weather variables: Temperature, Humidity, Wind Speed, Pressure, Visibility, - Cloud Cover, Precipitation, and UV Index. The color scheme uses a blue-orange - diverging palette (Altair''s "blueorange") centered at 0, where orange/brown indicates - positive correlations and blue indicates negative correlations. Each cell contains - a numeric annotation showing the correlation coefficient to two decimal places. - Cells with strong correlations (|r| >= 0.7) are highlighted with darker borders. - Text color adapts — white on dark cells, dark gray on light cells. The diagonal - shows 1.00 values. X-axis labels are positioned at the top at a -30 degree angle; - Y-axis labels are on the left. Both axes are labeled "Weather Variable." A vertical - color gradient legend labeled "Correlation" appears on the right side ranging - from -1.0 to 1.0. The title reads "heatmap-basic · altair · pyplots.ai" with subtitle - "Pairwise Pearson correlation coefficients for 8 weather metrics." White cell - borders with rounded corners separate the cells. Notable correlations include - Cloud Cover and Visibility (-0.77), Cloud Cover and Precipitation (0.63), and - Humidity and Cloud Cover (0.54).' + - Output dimensions (~2800x2920 at scale_factor=4.0) don't match either target format + (4800x2700 landscape or 3600x3600 square) — should use width/height that scales + to a target size + - Axis titles set to None — while acceptable for a correlation matrix, adding 'Weather + Variable' or similar would improve self-documentation + - Column label angle of -35 degrees gets tight with longer variable names — a steeper + angle or top-padding adjustment would help + image_description: 'The plot displays an 8x8 correlation heatmap of weather variables + (Temperature, Humidity, Wind Speed, Pressure, Visibility, Cloud Cover, Precipitation, + UV Index). The color scheme is a blue-orange diverging palette centered at zero: + strong positive correlations appear in dark orange/brown, strong negative correlations + in dark blue, and near-zero values in light cream/white. Each cell contains a + bold numeric annotation showing the Pearson correlation coefficient to two decimal + places. Text color adapts — white on strongly colored cells, dark gray on lighter + cells. Cells with |r| >= 0.7 have darker highlighted borders. Column labels are + rotated at -35 degrees along the top axis, row labels are on the left. A vertical + "Correlation" colorbar legend is positioned on the right. The title reads "heatmap-basic + · altair · pyplots.ai" with a subtitle "Pairwise Pearson correlation coefficients + for 8 weather metrics." The layout is clean with white cell separators and rounded + corners.' criteria_checklist: visual_quality: score: 26 @@ -71,43 +66,43 @@ review: score: 8 max: 8 passed: true - comment: 'All font sizes explicitly set: title 28pt, axis title 20pt, tick - labels 16pt, annotations 16pt bold, legend title 18pt, legend labels 16pt' + comment: 'All font sizes explicitly set: title 26pt, subtitle 16pt, axis labels + 15pt, cell text 15pt bold' - id: VQ-02 name: No Overlap score: 5 max: 6 passed: true - comment: X-axis labels angled at -30 degrees mostly avoid overlap but slight - cramping on end labels + comment: Column labels at -35 degrees slightly tight but still readable, no + actual overlap - id: VQ-03 name: Element Visibility score: 6 max: 6 passed: true - comment: All 64 cells clearly visible with strong color differentiation + comment: Cells optimally sized for 8x8 matrix - id: VQ-04 name: Color Accessibility score: 4 max: 4 passed: true - comment: Blue-orange diverging scheme is colorblind-safe with good contrast + comment: Blue-orange diverging scheme is colorblind-safe - id: VQ-05 name: Layout & Canvas score: 2 max: 4 passed: false - comment: Noticeable empty space around heatmap, colorbar legend somewhat isolated - to the right + comment: Output dimensions ~2800x2920 don't match target formats (4800x2700 + or 3600x3600) - id: VQ-06 name: Axis Labels & Title score: 1 max: 2 - passed: false - comment: Weather Variable is descriptive but redundant on both axes, no units - (though not applicable for correlation) + passed: true + comment: Axis titles set to None; acceptable for correlation matrix but could + be more descriptive design_excellence: - score: 14 + score: 15 max: 20 items: - id: DE-01 @@ -115,23 +110,22 @@ review: score: 6 max: 8 passed: true - comment: Strong design with blue-orange scheme, white cell borders with rounded - corners, border highlighting, adaptive text color. Above defaults but not - publication-level. + comment: 'Strong design: white cell borders with corner radius, custom diverging + palette, adaptive text color, highlight borders' - id: DE-02 name: Visual Refinement - score: 4 + score: 5 max: 6 passed: true - comment: Grid removed, view stroke removed, white cell borders, rounded corners, - generous padding. Good refinement visible. + comment: Grid removed, view stroke removed, padding configured, white separators, + rounded corners - id: DE-03 name: Data Storytelling score: 4 max: 6 passed: true - comment: Strong-correlation highlighting creates visual hierarchy. Correlation - clusters visible. Subtitle provides context. + comment: Highlight borders on strong correlations create visual hierarchy; + subtitle provides context spec_compliance: score: 15 max: 15 @@ -147,20 +141,20 @@ review: score: 4 max: 4 passed: true - comment: 'All spec features present: diverging colormap, value annotations, - colorbar legend, logical ordering' + comment: Diverging colormap, value annotations, colorbar legend, logical ordering + — all present - id: SC-03 name: Data Mapping score: 3 max: 3 passed: true - comment: X/Y correctly mapped as column/row variables + comment: X/Y correctly assigned as Column/Row - id: SC-04 name: Title & Legend score: 3 max: 3 passed: true - comment: Title format correct, colorbar legend labeled Correlation + comment: Correct title format with descriptive subtitle data_quality: score: 14 max: 15 @@ -170,22 +164,21 @@ review: score: 5 max: 6 passed: true - comment: Shows positive, negative, and near-zero correlations. Diagonal 1.00 - values. Good range but could have stronger negatives. + comment: Shows strong positive, strong negative, weak, and diagonal correlations - id: DQ-02 name: Realistic Context score: 5 max: 5 passed: true - comment: Weather metrics correlation is a real, neutral, comprehensible scenario + comment: Weather metrics correlation is a real, neutral scenario - id: DQ-03 name: Appropriate Scale score: 4 max: 4 passed: true - comment: All values in [-1, 1] range, realistic for weather data correlations + comment: All values realistic and within [-1, 1] code_quality: - score: 9 + score: 10 max: 10 items: - id: CQ-01 @@ -193,7 +186,7 @@ review: score: 3 max: 3 passed: true - comment: 'Clean flow: imports, data generation, plot, save. No functions/classes.' + comment: Clean imports → data → plot → save - id: CQ-02 name: Reproducibility score: 2 @@ -205,21 +198,20 @@ review: score: 2 max: 2 passed: true - comment: All imports used (altair, numpy, pandas) + comment: Only numpy, pandas, altair — all used - id: CQ-04 name: Code Elegance - score: 1 + score: 2 max: 2 - passed: false - comment: 'Slightly verbose: abs_value column only used for highlight filter, - records list-append loop could be more concise' + passed: true + comment: Well-organized, list comprehension, layered composition - id: CQ-05 name: Output & API score: 1 max: 1 passed: true - comment: Saves as plot.png and plot.html, no deprecated APIs - library_features: + comment: Saves plot.png and plot.html + library_mastery: score: 9 max: 10 items: @@ -228,13 +220,13 @@ review: score: 5 max: 5 passed: true - comment: 'Expert use of Altair declarative grammar: proper encoding types, - alt.X/Y with axis config, alt.Color with Scale, alt.Legend, alt.Title' + comment: Declarative grammar, encoding types, layered composition, transform_filter, + alt.when() conditional - id: LM-02 name: Distinctive Features score: 4 max: 5 passed: true - comment: 'Uses Altair-specific features: layer composition, alt.when().then().otherwise() - conditional encoding, tooltip encoding, declarative mark composition' - verdict: REJECTED + comment: alt.when().then().otherwise() for adaptive text, transform_filter + for highlights, tooltip encoding, + layer operator + verdict: APPROVED From 5273620e1d4c3a36be374d83aff39980ab26896d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Feb 2026 20:35:08 +0000 Subject: [PATCH 7/8] fix(altair): address review feedback for heatmap-basic Attempt 3/3 - fixes based on AI review --- plots/heatmap-basic/implementations/altair.py | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/plots/heatmap-basic/implementations/altair.py b/plots/heatmap-basic/implementations/altair.py index c973c9b307..e3cb03d08a 100644 --- a/plots/heatmap-basic/implementations/altair.py +++ b/plots/heatmap-basic/implementations/altair.py @@ -1,7 +1,6 @@ -""" pyplots.ai +"""pyplots.ai heatmap-basic: Basic Heatmap Library: altair 6.0.0 | Python 3.14.3 -Quality: 89/100 | Updated: 2026-02-15 """ import altair as alt @@ -56,11 +55,18 @@ .encode( x=alt.X( "Column:N", - title=None, + title="Weather Variable", sort=axis_order, - axis=alt.Axis(labelFontSize=15, labelAngle=-35, orient="top", labelPadding=6), + axis=alt.Axis( + labelFontSize=15, titleFontSize=18, labelAngle=-45, orient="top", labelPadding=8, titlePadding=10 + ), + ), + y=alt.Y( + "Row:N", + title="Weather Variable", + sort=axis_order, + axis=alt.Axis(labelFontSize=15, titleFontSize=18, labelPadding=8, titlePadding=10), ), - y=alt.Y("Row:N", title=None, sort=axis_order, axis=alt.Axis(labelFontSize=15, labelPadding=6)), color=alt.Color( "value:Q", scale=alt.Scale(scheme="blueorange", domain=[-1, 1], domainMid=0), @@ -109,23 +115,26 @@ chart = ( (heatmap + highlight + text) .properties( - width=700, - height=730, + width=740, + height=766, title=alt.Title( "heatmap-basic · altair · pyplots.ai", - subtitle="Pairwise Pearson correlation coefficients for 8 weather metrics", + subtitle=[ + "Pairwise Pearson correlation coefficients for 8 weather metrics.", + "Bold borders highlight strong relationships (|r| ≥ 0.7).", + ], fontSize=26, subtitleFontSize=16, subtitleColor="#666666", anchor="start", offset=16, ), - padding={"left": 10, "right": 10, "top": 10, "bottom": 10}, + padding={"left": 20, "right": 20, "top": 20, "bottom": 20}, ) .configure_axis(grid=False) .configure_view(strokeWidth=0) ) -# Save -chart.save("plot.png", scale_factor=4.0) +# Save — target: 3600×3600 square format +chart.save("plot.png", scale_factor=3.6) chart.save("plot.html") From 86a644d584ccf601413beec27e58ed7a66ea08b6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 16 Feb 2026 20:39:20 +0000 Subject: [PATCH 8/8] chore(altair): update quality score 88 and review feedback for heatmap-basic --- plots/heatmap-basic/implementations/altair.py | 3 +- plots/heatmap-basic/metadata/altair.yaml | 141 +++++++++--------- 2 files changed, 75 insertions(+), 69 deletions(-) diff --git a/plots/heatmap-basic/implementations/altair.py b/plots/heatmap-basic/implementations/altair.py index e3cb03d08a..9863d58aae 100644 --- a/plots/heatmap-basic/implementations/altair.py +++ b/plots/heatmap-basic/implementations/altair.py @@ -1,6 +1,7 @@ -"""pyplots.ai +""" pyplots.ai heatmap-basic: Basic Heatmap Library: altair 6.0.0 | Python 3.14.3 +Quality: 88/100 | Updated: 2026-02-16 """ import altair as alt diff --git a/plots/heatmap-basic/metadata/altair.yaml b/plots/heatmap-basic/metadata/altair.yaml index 8bc46644d3..31bab66fc1 100644 --- a/plots/heatmap-basic/metadata/altair.yaml +++ b/plots/heatmap-basic/metadata/altair.yaml @@ -1,7 +1,7 @@ library: altair specification_id: heatmap-basic created: '2025-12-23T00:48:16Z' -updated: '2026-02-15T21:49:09Z' +updated: '2026-02-16T20:39:19Z' generated_by: claude-opus-4-6 workflow_run: 20447968624 issue: 0 @@ -10,7 +10,7 @@ library_version: 6.0.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/heatmap-basic/altair/plot.html -quality_score: 89 +quality_score: 88 impl_tags: dependencies: [] techniques: @@ -27,38 +27,40 @@ impl_tags: - edge-highlighting review: strengths: - - Adaptive text color using alt.when() conditional encoding — white on dark cells, - dark on light cells — excellent readability - - Highlight borders on strong correlations (|r| >= 0.7) via transform_filter create - clear visual hierarchy - - Realistic weather correlation data with plausible injected relationships showing - variety of positive and negative correlations - - Clean layered composition (heatmap + highlight + text) is idiomatic Altair - - White cell separators with corner radius give a polished, modern appearance + - Excellent use of Altair's declarative layer composition (heatmap + highlight borders + + text annotations as separate layers) + - Adaptive text color using alt.when() conditional encoding ensures readability + on both dark and light cells + - Bold border highlighting for strong correlations (|r| >= 0.7) adds effective visual + storytelling + - Realistic weather correlation data with meaningful relationships injected via + controlled random correlations + - Clean, well-structured code with appropriate complexity for the visualization + - Informative subtitle that explains both the data and the highlighting convention weaknesses: - - Output dimensions (~2800x2920 at scale_factor=4.0) don't match either target format - (4800x2700 landscape or 3600x3600 square) — should use width/height that scales - to a target size - - Axis titles set to None — while acceptable for a correlation matrix, adding 'Weather - Variable' or similar would improve self-documentation - - Column label angle of -35 degrees gets tight with longer variable names — a steeper - angle or top-padding adjustment would help - image_description: 'The plot displays an 8x8 correlation heatmap of weather variables - (Temperature, Humidity, Wind Speed, Pressure, Visibility, Cloud Cover, Precipitation, - UV Index). The color scheme is a blue-orange diverging palette centered at zero: - strong positive correlations appear in dark orange/brown, strong negative correlations - in dark blue, and near-zero values in light cream/white. Each cell contains a - bold numeric annotation showing the Pearson correlation coefficient to two decimal - places. Text color adapts — white on strongly colored cells, dark gray on lighter - cells. Cells with |r| >= 0.7 have darker highlighted borders. Column labels are - rotated at -35 degrees along the top axis, row labels are on the left. A vertical - "Correlation" colorbar legend is positioned on the right. The title reads "heatmap-basic - · altair · pyplots.ai" with a subtitle "Pairwise Pearson correlation coefficients - for 8 weather metrics." The layout is clean with white cell separators and rounded - corners.' + - Layout balance could be improved — some whitespace imbalance around the colorbar + area + - Both axes share the identical title 'Weather Variable' which is redundant; consider + differentiating or removing one + - Feature coverage could include a stronger negative correlation (below -0.8) to + better demonstrate the full diverging scale + image_description: The plot displays an 8×8 correlation matrix heatmap of weather + variables (Temperature, Humidity, Wind Speed, Pressure, Visibility, Cloud Cover, + Precipitation, UV Index). It uses a blue-orange diverging color scheme centered + at 0, with correlation values annotated in each cell using bold text. The title + reads "heatmap-basic · altair · pyplots.ai" with two descriptive subtitle lines + explaining the data and the bold-border highlighting. Column labels are rotated + -45° at the top axis, row labels on the left. A vertical colorbar on the right + displays the correlation scale from -1.0 to 1.0 labeled "Correlation". Strong + correlations (|r| ≥ 0.7) are highlighted with darker border outlines. Text color + adapts automatically — white text on dark-colored cells, dark text on light-colored + cells. The diagonal shows perfect self-correlation (1.00). Notable relationships + include Visibility vs Cloud Cover at -0.77 (negative), Cloud Cover vs Precipitation + at 0.63 (positive), and Humidity vs Cloud Cover at 0.54 (positive). The layout + uses a square format with cells separated by thin white borders with rounded corners. criteria_checklist: visual_quality: - score: 26 + score: 27 max: 30 items: - id: VQ-01 @@ -67,20 +69,20 @@ review: max: 8 passed: true comment: 'All font sizes explicitly set: title 26pt, subtitle 16pt, axis labels - 15pt, cell text 15pt bold' + 15pt, axis titles 18pt, annotations 15pt bold' - id: VQ-02 name: No Overlap - score: 5 + score: 6 max: 6 passed: true - comment: Column labels at -35 degrees slightly tight but still readable, no - actual overlap + comment: No overlapping text; labels rotated -45° prevent collision; annotations + fit within cells - id: VQ-03 name: Element Visibility score: 6 max: 6 passed: true - comment: Cells optimally sized for 8x8 matrix + comment: Cells well-sized for 8x8 matrix; white borders separate cells cleanly - id: VQ-04 name: Color Accessibility score: 4 @@ -88,21 +90,21 @@ review: passed: true comment: Blue-orange diverging scheme is colorblind-safe - id: VQ-05 - name: Layout & Canvas + name: Layout Balance score: 2 max: 4 passed: false - comment: Output dimensions ~2800x2920 don't match target formats (4800x2700 - or 3600x3600) + comment: Square format appropriate but some whitespace imbalance with colorbar + placement - id: VQ-06 name: Axis Labels & Title score: 1 max: 2 - passed: true - comment: Axis titles set to None; acceptable for correlation matrix but could - be more descriptive + passed: false + comment: Weather Variable is descriptive but identical for both axes; no units + (not applicable for correlation) design_excellence: - score: 15 + score: 14 max: 20 items: - id: DE-01 @@ -110,24 +112,24 @@ review: score: 6 max: 8 passed: true - comment: 'Strong design: white cell borders with corner radius, custom diverging - palette, adaptive text color, highlight borders' + comment: 'Strong design: adaptive text colors, rounded corners, white cell + borders, bold-border highlighting, informative subtitle' - id: DE-02 name: Visual Refinement score: 5 max: 6 passed: true - comment: Grid removed, view stroke removed, padding configured, white separators, - rounded corners + comment: Grid removed, view stroke removed, subtle cell borders, generous + padding, corner radius styling - id: DE-03 name: Data Storytelling score: 4 max: 6 passed: true - comment: Highlight borders on strong correlations create visual hierarchy; - subtitle provides context + comment: Bold borders guide viewer to strong correlations; subtitle explains + what to look for; color highlights extremes spec_compliance: - score: 15 + score: 14 max: 15 items: - id: SC-01 @@ -141,20 +143,21 @@ review: score: 4 max: 4 passed: true - comment: Diverging colormap, value annotations, colorbar legend, logical ordering - — all present + comment: Diverging colormap, cell annotations, colorbar, logical ordering, + strong-correlation highlighting - id: SC-03 name: Data Mapping score: 3 max: 3 passed: true - comment: X/Y correctly assigned as Column/Row + comment: X/Y correctly mapped as Column and Row weather variables - id: SC-04 name: Title & Legend - score: 3 + score: 2 max: 3 - passed: true - comment: Correct title format with descriptive subtitle + passed: false + comment: Title format correct; colorbar legend appropriate; both axes share + same redundant title data_quality: score: 14 max: 15 @@ -164,19 +167,21 @@ review: score: 5 max: 6 passed: true - comment: Shows strong positive, strong negative, weak, and diagonal correlations + comment: Shows positive, negative, near-zero correlations and diagonal; good + range of strengths - id: DQ-02 name: Realistic Context score: 5 max: 5 passed: true - comment: Weather metrics correlation is a real, neutral scenario + comment: 'Weather metrics: real, neutral, scientifically meaningful scenario + with realistic relationships' - id: DQ-03 name: Appropriate Scale score: 4 max: 4 passed: true - comment: All values realistic and within [-1, 1] + comment: Correlation values -0.77 to 1.00, all plausible for weather data code_quality: score: 10 max: 10 @@ -186,31 +191,31 @@ review: score: 3 max: 3 passed: true - comment: Clean imports → data → plot → save + comment: Clean imports, data, plot, save structure; no functions/classes - id: CQ-02 name: Reproducibility score: 2 max: 2 passed: true - comment: np.random.seed(42) set + comment: np.random.seed(42) - id: CQ-03 name: Clean Imports score: 2 max: 2 passed: true - comment: Only numpy, pandas, altair — all used + comment: All imports used (altair, numpy, pandas) - id: CQ-04 name: Code Elegance score: 2 max: 2 passed: true - comment: Well-organized, list comprehension, layered composition + comment: Clean list comprehension, layered composition, appropriate complexity - id: CQ-05 name: Output & API score: 1 max: 1 passed: true - comment: Saves plot.png and plot.html + comment: Saves plot.png and plot.html, no deprecated functions library_mastery: score: 9 max: 10 @@ -220,13 +225,13 @@ review: score: 5 max: 5 passed: true - comment: Declarative grammar, encoding types, layered composition, transform_filter, - alt.when() conditional + comment: 'Expert Altair: declarative layers, conditional encoding, transform_filter, + proper type encodings' - id: LM-02 name: Distinctive Features score: 4 max: 5 passed: true - comment: alt.when().then().otherwise() for adaptive text, transform_filter - for highlights, tooltip encoding, + layer operator + comment: alt.when().then().otherwise() conditional encoding, transform_filter, + tooltip + HTML export, layer composition verdict: APPROVED