From 230b3006354ee8cc8ce5ca0748ecc1a43182bd42 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Dec 2025 19:30:44 +0000 Subject: [PATCH 1/5] feat(pygal): implement scatter-size-mapped --- .../implementations/pygal.py | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 plots/scatter-size-mapped/implementations/pygal.py diff --git a/plots/scatter-size-mapped/implementations/pygal.py b/plots/scatter-size-mapped/implementations/pygal.py new file mode 100644 index 0000000000..05e9513987 --- /dev/null +++ b/plots/scatter-size-mapped/implementations/pygal.py @@ -0,0 +1,92 @@ +"""pyplots.ai +scatter-size-mapped: Bubble Chart +Library: pygal | Python 3.13 +Quality: pending | Created: 2025-12-27 +""" + +import numpy as np +import pygal +from pygal.style import Style + + +# Data: Country economic indicators +np.random.seed(42) + +# Generate 40 synthetic countries across different regions +n_countries = 40 +regions = ["Europe", "Asia", "Americas", "Africa"] + +# Assign regions with some variation +region_assignments = np.random.choice(regions, n_countries) + +# GDP per capita (1,000 - 80,000) +gdp_per_capita = np.random.uniform(5000, 75000, n_countries) +# Adjust by region for realism +for i, region in enumerate(region_assignments): + if region == "Europe": + gdp_per_capita[i] = np.random.uniform(25000, 75000) + elif region == "Asia": + gdp_per_capita[i] = np.random.uniform(5000, 60000) + elif region == "Americas": + gdp_per_capita[i] = np.random.uniform(8000, 70000) + else: # Africa + gdp_per_capita[i] = np.random.uniform(1000, 20000) + +# Life expectancy (50-85) correlated with GDP +life_expectancy = 50 + 30 * (gdp_per_capita / 80000) + np.random.uniform(-5, 5, n_countries) +life_expectancy = np.clip(life_expectancy, 50, 85) + +# Population (log scale, 1M - 1.4B) +population = 10 ** np.random.uniform(6, 9.2, n_countries) + +# Create custom style +custom_style = Style( + background="white", + plot_background="white", + foreground="#333333", + foreground_strong="#333333", + foreground_subtle="#666666", + colors=("#306998", "#FFD43B", "#E74C3C", "#27AE60", "#9B59B6"), + title_font_size=72, + label_font_size=48, + major_label_font_size=40, + legend_font_size=40, + value_font_size=36, + opacity=0.6, + opacity_hover=0.8, +) + +# Create XY chart for scatter plot +chart = pygal.XY( + width=4800, + height=2700, + style=custom_style, + title="scatter-size-mapped 路 pygal 路 pyplots.ai", + x_title="GDP per Capita (USD)", + y_title="Life Expectancy (years)", + show_legend=True, + legend_at_bottom=True, + legend_at_bottom_columns=4, + dots_size=15, + show_x_guides=True, + show_y_guides=True, + stroke=False, + explicit_size=True, + truncate_legend=-1, +) + +# Group data by region and add as series +# Pygal XY chart uses value dict with 'value' for coordinates +for region in regions: + mask = region_assignments == region + points = [] + for i in np.where(mask)[0]: + # Scale population to reasonable dot size (log scale) + # Population ranges from 1M to 1.4B, scale to 5-60 for visibility + size = 5 + 55 * (np.log10(population[i]) - 6) / 3.2 + points.append({"value": (float(gdp_per_capita[i]), float(life_expectancy[i])), "node": {"r": size}}) + chart.add(region, points) + +# Render to files +chart.render_to_png("plot.png") +chart.render_to_file("plot.html") From c3aed242bd63f3fbbcb3945a814f4c1d62ea1787 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Dec 2025 19:31:04 +0000 Subject: [PATCH 2/5] chore(pygal): add metadata for scatter-size-mapped --- plots/scatter-size-mapped/metadata/pygal.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plots/scatter-size-mapped/metadata/pygal.yaml diff --git a/plots/scatter-size-mapped/metadata/pygal.yaml b/plots/scatter-size-mapped/metadata/pygal.yaml new file mode 100644 index 0000000000..391a981b36 --- /dev/null +++ b/plots/scatter-size-mapped/metadata/pygal.yaml @@ -0,0 +1,19 @@ +# Per-library metadata for pygal implementation of scatter-size-mapped +# Auto-generated by impl-generate.yml + +library: pygal +specification_id: scatter-size-mapped +created: '2025-12-27T19:31:03Z' +updated: '2025-12-27T19:31:03Z' +generated_by: claude-opus-4-5-20251101 +workflow_run: 20543371845 +issue: 0 +python_version: 3.13.11 +library_version: 3.1.0 +preview_url: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot.png +preview_thumb: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot_thumb.png +preview_html: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot.html +quality_score: null +review: + strengths: [] + weaknesses: [] From 063c626933038594db233d35e2c65dd83f06e3c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Dec 2025 19:37:46 +0000 Subject: [PATCH 3/5] chore(pygal): update quality score 88 and review feedback for scatter-size-mapped --- .../implementations/pygal.py | 6 ++--- plots/scatter-size-mapped/metadata/pygal.yaml | 23 +++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/plots/scatter-size-mapped/implementations/pygal.py b/plots/scatter-size-mapped/implementations/pygal.py index 05e9513987..75efe2c48a 100644 --- a/plots/scatter-size-mapped/implementations/pygal.py +++ b/plots/scatter-size-mapped/implementations/pygal.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai scatter-size-mapped: Bubble Chart -Library: pygal | Python 3.13 -Quality: pending | Created: 2025-12-27 +Library: pygal 3.1.0 | Python 3.13.11 +Quality: 88/100 | Created: 2025-12-27 """ import numpy as np diff --git a/plots/scatter-size-mapped/metadata/pygal.yaml b/plots/scatter-size-mapped/metadata/pygal.yaml index 391a981b36..2e5fedd1c1 100644 --- a/plots/scatter-size-mapped/metadata/pygal.yaml +++ b/plots/scatter-size-mapped/metadata/pygal.yaml @@ -1,10 +1,7 @@ -# Per-library metadata for pygal implementation of scatter-size-mapped -# Auto-generated by impl-generate.yml - library: pygal specification_id: scatter-size-mapped created: '2025-12-27T19:31:03Z' -updated: '2025-12-27T19:31:03Z' +updated: '2025-12-27T19:37:46Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20543371845 issue: 0 @@ -13,7 +10,19 @@ library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot.html -quality_score: null +quality_score: 88 review: - strengths: [] - weaknesses: [] + strengths: + - Excellent data generation with realistic regional patterns (Europe higher GDP, + Africa lower) + - Clean implementation using pygal XY chart with proper node size customization + via node dict + - Good use of custom Style for visual consistency + - Proper semi-transparency (opacity=0.6) for overlapping bubbles + - Correct title format following spec requirements + - Both axis labels include appropriate units + weaknesses: + - Missing size legend to indicate what bubble sizes represent (spec requirement) + - Some smaller bubbles are difficult to see at lower population values + - Library-specific font sizes are quite large but rendering appears smaller than + expected From 99c9fe404d4bb025d31e817af2a24f7acdb5e012 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Dec 2025 19:40:55 +0000 Subject: [PATCH 4/5] fix(pygal): address review feedback for scatter-size-mapped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add size legend in title: "Bubble Size = Population (1M to 1B+)" - Increase minimum bubble size from 5 to 12 for better visibility - Increase font sizes for better rendering (title 84, label 56, etc.) Attempt 1/3 - fixes based on AI review 馃 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../implementations/pygal.py | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/plots/scatter-size-mapped/implementations/pygal.py b/plots/scatter-size-mapped/implementations/pygal.py index 75efe2c48a..dc0ff9fe23 100644 --- a/plots/scatter-size-mapped/implementations/pygal.py +++ b/plots/scatter-size-mapped/implementations/pygal.py @@ -1,4 +1,4 @@ -""" pyplots.ai +"""pyplots.ai scatter-size-mapped: Bubble Chart Library: pygal 3.1.0 | Python 3.13.11 Quality: 88/100 | Created: 2025-12-27 @@ -39,7 +39,7 @@ # Population (log scale, 1M - 1.4B) population = 10 ** np.random.uniform(6, 9.2, n_countries) -# Create custom style +# Create custom style with larger font sizes for better rendering custom_style = Style( background="white", plot_background="white", @@ -47,21 +47,24 @@ foreground_strong="#333333", foreground_subtle="#666666", colors=("#306998", "#FFD43B", "#E74C3C", "#27AE60", "#9B59B6"), - title_font_size=72, - label_font_size=48, - major_label_font_size=40, - legend_font_size=40, - value_font_size=36, + title_font_size=84, + label_font_size=56, + major_label_font_size=48, + legend_font_size=44, + value_font_size=40, opacity=0.6, opacity_hover=0.8, ) +# Title with size legend information +title = "scatter-size-mapped 路 pygal 路 pyplots.ai\nBubble Size = Population (1M to 1B+)" + # Create XY chart for scatter plot chart = pygal.XY( width=4800, height=2700, style=custom_style, - title="scatter-size-mapped 路 pygal 路 pyplots.ai", + title=title, x_title="GDP per Capita (USD)", y_title="Life Expectancy (years)", show_legend=True, @@ -82,8 +85,9 @@ points = [] for i in np.where(mask)[0]: # Scale population to reasonable dot size (log scale) - # Population ranges from 1M to 1.4B, scale to 5-60 for visibility - size = 5 + 55 * (np.log10(population[i]) - 6) / 3.2 + # Population ranges from 1M to 1.4B, scale to 12-70 for better visibility + # Increased minimum size from 5 to 12 so smaller bubbles are visible + size = 12 + 58 * (np.log10(population[i]) - 6) / 3.2 points.append({"value": (float(gdp_per_capita[i]), float(life_expectancy[i])), "node": {"r": size}}) chart.add(region, points) From d7072a7d45ea196dd6ebc0de02f9211c6fe088fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 27 Dec 2025 19:43:27 +0000 Subject: [PATCH 5/5] chore(pygal): update quality score 91 and review feedback for scatter-size-mapped --- .../implementations/pygal.py | 4 +-- plots/scatter-size-mapped/metadata/pygal.yaml | 29 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/plots/scatter-size-mapped/implementations/pygal.py b/plots/scatter-size-mapped/implementations/pygal.py index dc0ff9fe23..b9552669bb 100644 --- a/plots/scatter-size-mapped/implementations/pygal.py +++ b/plots/scatter-size-mapped/implementations/pygal.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai scatter-size-mapped: Bubble Chart Library: pygal 3.1.0 | Python 3.13.11 -Quality: 88/100 | Created: 2025-12-27 +Quality: 91/100 | Created: 2025-12-27 """ import numpy as np diff --git a/plots/scatter-size-mapped/metadata/pygal.yaml b/plots/scatter-size-mapped/metadata/pygal.yaml index 2e5fedd1c1..c15dd02c39 100644 --- a/plots/scatter-size-mapped/metadata/pygal.yaml +++ b/plots/scatter-size-mapped/metadata/pygal.yaml @@ -1,7 +1,7 @@ library: pygal specification_id: scatter-size-mapped created: '2025-12-27T19:31:03Z' -updated: '2025-12-27T19:37:46Z' +updated: '2025-12-27T19:43:26Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20543371845 issue: 0 @@ -10,19 +10,20 @@ library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/scatter-size-mapped/pygal/plot.html -quality_score: 88 +quality_score: 91 review: strengths: - - Excellent data generation with realistic regional patterns (Europe higher GDP, - Africa lower) - - Clean implementation using pygal XY chart with proper node size customization - via node dict - - Good use of custom Style for visual consistency - - Proper semi-transparency (opacity=0.6) for overlapping bubbles - - Correct title format following spec requirements - - Both axis labels include appropriate units + - Excellent realistic data generation with regional economic patterns (Europe higher + GDP, Africa lower GDP) + - Proper use of pygal XY chart with custom node sizes via the node dict parameter + for bubble sizing + - Well-implemented semi-transparency (opacity=0.6) for distinguishing overlapping + bubbles + - Clean code structure following KISS principles with proper seed for reproducibility + - Size legend integrated into title subtitle (Bubble Size = Population 1M to 1B+) + - Improved minimum bubble size (12) from previous attempt makes smaller populations + more visible weaknesses: - - Missing size legend to indicate what bubble sizes represent (spec requirement) - - Some smaller bubbles are difficult to see at lower population values - - Library-specific font sizes are quite large but rendering appears smaller than - expected + - Grid lines are too subtle and barely visible - could use more prominent guide + styling + - Title format includes subtitle which slightly deviates from the exact spec format