From 7d0116d8827e1c1738c7a5527411f3da4fca0c7c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 31 Dec 2025 13:57:33 +0000 Subject: [PATCH 1/3] feat(pygal): implement choropleth-basic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../choropleth-basic/implementations/pygal.py | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 plots/choropleth-basic/implementations/pygal.py diff --git a/plots/choropleth-basic/implementations/pygal.py b/plots/choropleth-basic/implementations/pygal.py new file mode 100644 index 0000000000..33ce22e3c8 --- /dev/null +++ b/plots/choropleth-basic/implementations/pygal.py @@ -0,0 +1,117 @@ +"""pyplots.ai +choropleth-basic: Choropleth Map with Regional Coloring +Library: pygal | Python 3.13 +Quality: pending | Created: 2025-12-31 +""" + +import numpy as np +from pygal.style import Style +from pygal_maps_world.maps import World + + +# Data: GDP per capita (synthetic but realistic ranges) +np.random.seed(42) + +# Select a diverse set of countries from different regions +country_codes = [ + # Americas + "us", + "ca", + "mx", + "br", + "ar", + "cl", + "co", + "pe", + # Europe + "de", + "fr", + "gb", + "it", + "es", + "nl", + "se", + "no", + "pl", + "pt", + # Asia + "cn", + "jp", + "in", + "kr", + "id", + "th", + "vn", + "my", + # Africa + "za", + "eg", + "ng", + "ke", + "ma", + "gh", + # Oceania + "au", + "nz", +] + +# Generate realistic GDP per capita values (in thousands USD) +high_income = ["us", "ca", "de", "fr", "gb", "nl", "se", "no", "jp", "kr", "au", "nz"] +upper_middle = ["mx", "br", "ar", "cl", "cn", "my", "za", "pl", "pt", "it", "es"] + +gdp_data = {} +for code in country_codes: + if code in high_income: + gdp_data[code] = np.random.uniform(40, 85) + elif code in upper_middle: + gdp_data[code] = np.random.uniform(10, 40) + else: + gdp_data[code] = np.random.uniform(1, 15) + +# Bin data into ranges for legend clarity +bins = [ + ("GDP < $10k", {k: v for k, v in gdp_data.items() if v < 10}), + ("GDP $10k-$25k", {k: v for k, v in gdp_data.items() if 10 <= v < 25}), + ("GDP $25k-$50k", {k: v for k, v in gdp_data.items() if 25 <= v < 50}), + ("GDP > $50k", {k: v for k, v in gdp_data.items() if v >= 50}), +] + +# Sequential blue palette for choropleth (light to dark) +colors = ["#a6cee3", "#6baed6", "#3182bd", "#08519c"] + +# Custom style for large canvas +custom_style = Style( + background="white", + plot_background="white", + foreground="#333333", + foreground_strong="#111111", + foreground_subtle="#666666", + colors=tuple(colors), + title_font_size=80, + label_font_size=48, + legend_font_size=48, + major_label_font_size=40, + value_font_size=40, + tooltip_font_size=36, + no_data_font_size=36, +) + +# Create world map +worldmap = World( + style=custom_style, + width=4800, + height=2700, + title="choropleth-basic \u00b7 pygal \u00b7 pyplots.ai", + show_legend=True, + legend_at_bottom=True, + legend_at_bottom_columns=4, + legend_box_size=40, +) + +# Add each bin as a separate series +for label, data in bins: + worldmap.add(label, data) + +# Save outputs +worldmap.render_to_file("plot.html") +worldmap.render_to_png("plot.png") From 6197e88d374208640017ea9d5b4fd97a8e40860c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 31 Dec 2025 13:57:55 +0000 Subject: [PATCH 2/3] chore(pygal): add metadata for choropleth-basic --- plots/choropleth-basic/metadata/pygal.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plots/choropleth-basic/metadata/pygal.yaml diff --git a/plots/choropleth-basic/metadata/pygal.yaml b/plots/choropleth-basic/metadata/pygal.yaml new file mode 100644 index 0000000000..78e0d0774f --- /dev/null +++ b/plots/choropleth-basic/metadata/pygal.yaml @@ -0,0 +1,19 @@ +# Per-library metadata for pygal implementation of choropleth-basic +# Auto-generated by impl-generate.yml + +library: pygal +specification_id: choropleth-basic +created: '2025-12-31T13:57:54Z' +updated: '2025-12-31T13:57:54Z' +generated_by: claude-opus-4-5-20251101 +workflow_run: 20620327898 +issue: 3069 +python_version: 3.13.11 +library_version: 3.1.0 +preview_url: https://storage.googleapis.com/pyplots-images/plots/choropleth-basic/pygal/plot.png +preview_thumb: https://storage.googleapis.com/pyplots-images/plots/choropleth-basic/pygal/plot_thumb.png +preview_html: https://storage.googleapis.com/pyplots-images/plots/choropleth-basic/pygal/plot.html +quality_score: null +review: + strengths: [] + weaknesses: [] From 44777aec0fb54e8140afb0d330204a78843b9942 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 31 Dec 2025 14:09:13 +0000 Subject: [PATCH 3/3] chore(pygal): update quality score 91 and review feedback for choropleth-basic --- .../choropleth-basic/implementations/pygal.py | 6 +++--- plots/choropleth-basic/metadata/pygal.yaml | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/plots/choropleth-basic/implementations/pygal.py b/plots/choropleth-basic/implementations/pygal.py index 33ce22e3c8..fe6ed8e91e 100644 --- a/plots/choropleth-basic/implementations/pygal.py +++ b/plots/choropleth-basic/implementations/pygal.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai choropleth-basic: Choropleth Map with Regional Coloring -Library: pygal | Python 3.13 -Quality: pending | Created: 2025-12-31 +Library: pygal 3.1.0 | Python 3.13.11 +Quality: 91/100 | Created: 2025-12-31 """ import numpy as np diff --git a/plots/choropleth-basic/metadata/pygal.yaml b/plots/choropleth-basic/metadata/pygal.yaml index 78e0d0774f..3463afd236 100644 --- a/plots/choropleth-basic/metadata/pygal.yaml +++ b/plots/choropleth-basic/metadata/pygal.yaml @@ -1,10 +1,7 @@ -# Per-library metadata for pygal implementation of choropleth-basic -# Auto-generated by impl-generate.yml - library: pygal specification_id: choropleth-basic created: '2025-12-31T13:57:54Z' -updated: '2025-12-31T13:57:54Z' +updated: '2025-12-31T14:09:13Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20620327898 issue: 3069 @@ -13,7 +10,15 @@ library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/choropleth-basic/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/choropleth-basic/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/choropleth-basic/pygal/plot.html -quality_score: null +quality_score: 91 review: - strengths: [] - weaknesses: [] + strengths: + - Excellent use of pygal_maps_world extension for creating a world choropleth map + - Sequential blue color palette is visually appealing and colorblind-accessible + - Good binning approach that creates clear visual distinctions between income levels + - Comprehensive geographic coverage spanning all major continents + - Custom Style properly scales fonts for the 4800x2700 canvas size + - Legend placement at bottom with 4 columns efficiently organizes the GDP ranges + weaknesses: + - Missing data countries shown as white rather than gray as suggested in spec + - Could leverage pygal's built-in tooltip/hover interactivity more prominently