From f8d3c736d0e2e8d50572fba81b10481275197b25 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 10 Jan 2026 06:09:45 +0000 Subject: [PATCH 1/3] feat(altair): implement bubble-map-geographic --- .../implementations/altair.py | 255 ++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100644 plots/bubble-map-geographic/implementations/altair.py diff --git a/plots/bubble-map-geographic/implementations/altair.py b/plots/bubble-map-geographic/implementations/altair.py new file mode 100644 index 0000000000..03fab7e757 --- /dev/null +++ b/plots/bubble-map-geographic/implementations/altair.py @@ -0,0 +1,255 @@ +"""pyplots.ai +bubble-map-geographic: Bubble Map with Sized Geographic Markers +Library: altair | Python 3.13 +Quality: pending | Created: 2026-01-10 +""" + +import altair as alt +import pandas as pd + + +# Data: Major world cities with population (millions) +cities_data = { + "city": [ + "Tokyo", + "Delhi", + "Shanghai", + "Sao Paulo", + "Mexico City", + "Cairo", + "Mumbai", + "Beijing", + "Dhaka", + "Osaka", + "New York", + "Karachi", + "Buenos Aires", + "Istanbul", + "Lagos", + "Los Angeles", + "Kolkata", + "Manila", + "Rio de Janeiro", + "Guangzhou", + "Moscow", + "Shenzhen", + "Paris", + "Jakarta", + "Lima", + "Bangkok", + "London", + "Chicago", + "Bogota", + "Sydney", + ], + "latitude": [ + 35.68, + 28.61, + 31.23, + -23.55, + 19.43, + 30.04, + 19.08, + 39.90, + 23.81, + 34.69, + 40.71, + 24.86, + -34.60, + 41.01, + 6.52, + 34.05, + 22.57, + 14.60, + -22.91, + 23.13, + 55.76, + 22.54, + 48.86, + -6.21, + -12.05, + 13.76, + 51.51, + 41.88, + 4.71, + -33.87, + ], + "longitude": [ + 139.69, + 77.21, + 121.47, + -46.63, + -99.13, + 31.24, + 72.88, + 116.41, + 90.41, + 135.50, + -74.01, + 67.01, + -58.38, + 28.98, + 3.38, + -118.24, + 88.36, + 120.98, + -43.17, + 113.26, + 37.62, + 114.06, + 2.35, + 106.85, + -77.04, + 100.50, + -0.13, + -87.63, + -74.07, + 151.21, + ], + "population": [ + 37.4, + 32.9, + 29.2, + 22.4, + 21.8, + 21.3, + 21.0, + 20.9, + 22.5, + 19.1, + 18.8, + 16.8, + 15.4, + 15.6, + 15.3, + 12.5, + 15.1, + 14.4, + 13.5, + 14.3, + 12.5, + 13.4, + 11.0, + 11.2, + 11.0, + 10.7, + 9.5, + 8.9, + 11.3, + 5.4, + ], + "region": [ + "Asia", + "Asia", + "Asia", + "South America", + "North America", + "Africa", + "Asia", + "Asia", + "Asia", + "Asia", + "North America", + "Asia", + "South America", + "Europe", + "Africa", + "North America", + "Asia", + "Asia", + "South America", + "Asia", + "Europe", + "Asia", + "Europe", + "Asia", + "South America", + "Asia", + "Europe", + "North America", + "South America", + "Oceania", + ], +} + +df = pd.DataFrame(cities_data) + +# Load world map from vega-datasets URL (works without vega_datasets package) +world_url = "https://cdn.jsdelivr.net/npm/vega-datasets@2/data/world-110m.json" +countries = alt.topo_feature(world_url, "countries") + +# Region color mapping (colorblind-safe) +region_colors = { + "Asia": "#306998", + "Europe": "#FFD43B", + "North America": "#2CA02C", + "South America": "#D62728", + "Africa": "#9467BD", + "Oceania": "#17BECF", +} + +# Create base map with country boundaries +base_map = ( + alt.Chart(countries) + .mark_geoshape(fill="#E8E8E0", stroke="#B0B0B0", strokeWidth=0.5) + .project(type="equirectangular", scale=280, translate=[800, 480]) + .properties(width=1600, height=900) +) + +# Create bubble layer with sized markers +bubbles = ( + alt.Chart(df) + .mark_circle(opacity=0.7, stroke="#FFFFFF", strokeWidth=1.5) + .encode( + longitude="longitude:Q", + latitude="latitude:Q", + size=alt.Size( + "population:Q", + scale=alt.Scale(domain=[5, 40], range=[100, 2500]), + legend=alt.Legend( + title="Population (millions)", + titleFontSize=16, + labelFontSize=14, + symbolFillColor="#306998", + orient="bottom-left", + offset=20, + ), + ), + color=alt.Color( + "region:N", + scale=alt.Scale(domain=list(region_colors.keys()), range=list(region_colors.values())), + legend=alt.Legend(title="Region", titleFontSize=16, labelFontSize=14, orient="bottom-right", offset=20), + ), + tooltip=[ + alt.Tooltip("city:N", title="City"), + alt.Tooltip("population:Q", title="Population (M)", format=".1f"), + alt.Tooltip("region:N", title="Region"), + alt.Tooltip("latitude:Q", title="Latitude", format=".2f"), + alt.Tooltip("longitude:Q", title="Longitude", format=".2f"), + ], + ) + .project(type="equirectangular", scale=280, translate=[800, 480]) +) + +# Combine base map and bubbles +chart = ( + (base_map + bubbles) + .properties( + title=alt.Title( + text="World City Populations · bubble-map-geographic · altair · pyplots.ai", + fontSize=28, + anchor="middle", + color="#333333", + ), + width=1600, + height=900, + ) + .configure_view(stroke=None) + .configure_legend(titleColor="#333333", labelColor="#555555", padding=15, cornerRadius=5) +) + +# Save as PNG (scale 3x for 4800x2700) +chart.save("plot.png", scale_factor=3.0) + +# Save interactive HTML version +chart.save("plot.html") From 7dc1f3c82f4b03285691f799357c25e9db9ae183 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 10 Jan 2026 06:10:00 +0000 Subject: [PATCH 2/3] chore(altair): add metadata for bubble-map-geographic --- .../metadata/altair.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plots/bubble-map-geographic/metadata/altair.yaml diff --git a/plots/bubble-map-geographic/metadata/altair.yaml b/plots/bubble-map-geographic/metadata/altair.yaml new file mode 100644 index 0000000000..d606bb0fce --- /dev/null +++ b/plots/bubble-map-geographic/metadata/altair.yaml @@ -0,0 +1,19 @@ +# Per-library metadata for altair implementation of bubble-map-geographic +# Auto-generated by impl-generate.yml + +library: altair +specification_id: bubble-map-geographic +created: '2026-01-10T06:10:00Z' +updated: '2026-01-10T06:10:00Z' +generated_by: claude-opus-4-5-20251101 +workflow_run: 20873958906 +issue: 3625 +python_version: 3.13.11 +library_version: 6.0.0 +preview_url: https://storage.googleapis.com/pyplots-images/plots/bubble-map-geographic/altair/plot.png +preview_thumb: https://storage.googleapis.com/pyplots-images/plots/bubble-map-geographic/altair/plot_thumb.png +preview_html: https://storage.googleapis.com/pyplots-images/plots/bubble-map-geographic/altair/plot.html +quality_score: null +review: + strengths: [] + weaknesses: [] From 7d69d960ea8b51a1d7289318c4f65ba26f1c2c78 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 10 Jan 2026 06:12:46 +0000 Subject: [PATCH 3/3] chore(altair): update quality score 93 and review feedback for bubble-map-geographic --- .../implementations/altair.py | 6 +- .../metadata/altair.yaml | 217 +++++++++++++++++- 2 files changed, 213 insertions(+), 10 deletions(-) diff --git a/plots/bubble-map-geographic/implementations/altair.py b/plots/bubble-map-geographic/implementations/altair.py index 03fab7e757..94d5d36ecf 100644 --- a/plots/bubble-map-geographic/implementations/altair.py +++ b/plots/bubble-map-geographic/implementations/altair.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai bubble-map-geographic: Bubble Map with Sized Geographic Markers -Library: altair | Python 3.13 -Quality: pending | Created: 2026-01-10 +Library: altair 6.0.0 | Python 3.13.11 +Quality: 93/100 | Created: 2026-01-10 """ import altair as alt diff --git a/plots/bubble-map-geographic/metadata/altair.yaml b/plots/bubble-map-geographic/metadata/altair.yaml index d606bb0fce..0a225c4e4f 100644 --- a/plots/bubble-map-geographic/metadata/altair.yaml +++ b/plots/bubble-map-geographic/metadata/altair.yaml @@ -1,10 +1,7 @@ -# Per-library metadata for altair implementation of bubble-map-geographic -# Auto-generated by impl-generate.yml - library: altair specification_id: bubble-map-geographic created: '2026-01-10T06:10:00Z' -updated: '2026-01-10T06:10:00Z' +updated: '2026-01-10T06:12:46Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20873958906 issue: 3625 @@ -13,7 +10,213 @@ library_version: 6.0.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/bubble-map-geographic/altair/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/bubble-map-geographic/altair/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/bubble-map-geographic/altair/plot.html -quality_score: null +quality_score: 93 review: - strengths: [] - weaknesses: [] + strengths: + - Excellent use of Altair declarative grammar for geographic visualization + - Proper layering of basemap and bubble overlay with matching projections + - Good use of tooltips showing city, population, region, and coordinates + - Clean code structure with well-organized data definition + - Appropriate bubble sizing with scale domain matching data range + - White stroke outlines improve bubble distinction + - Both PNG and HTML outputs for static and interactive viewing + weaknesses: + - Size legend uses single color rather than showing how colors vary by region in + the actual bubbles + - Code lacks a reproducibility comment about data source + image_description: 'The plot displays a world map with an equirectangular projection + showing major city populations as sized circular markers. The base map shows country + boundaries in light gray (#E8E8E0) with subtle borders. Bubbles are positioned + at city locations with size proportional to population (5-40 million range). Colors + encode regions: blue for Asia, yellow for Europe, green for North America, red/coral + for South America, purple for Africa, and cyan for Oceania. Tokyo appears as the + largest bubble in Asia. A size legend on the bottom-left shows the population + scale (5-40 million), and a color legend on the bottom-right identifies regions. + The title "World City Populations · bubble-map-geographic · altair · pyplots.ai" + is displayed at the top center. White stroke outlines on bubbles (1.5px) provide + separation, and 70% opacity enables viewing of overlapping markers in dense areas + like East Asia.' + criteria_checklist: + visual_quality: + score: 37 + max: 40 + items: + - id: VQ-01 + name: Text Legibility + score: 10 + max: 10 + passed: true + comment: Title at 28pt, legend titles at 16pt, labels at 14pt - all readable + at full resolution + - id: VQ-02 + name: No Overlap + score: 8 + max: 8 + passed: true + comment: No text overlap; bubble overlap is intentional and handled well with + alpha + - id: VQ-03 + name: Element Visibility + score: 7 + max: 8 + passed: true + comment: Bubbles well-sized for data density; white strokes help distinguish + overlapping markers; minor deduction for smaller markers being slightly + less prominent + - id: VQ-04 + name: Color Accessibility + score: 5 + max: 5 + passed: true + comment: Six distinct colors for regions are colorblind-safe; blue/yellow/green/red/purple/cyan + palette + - id: VQ-05 + name: Layout Balance + score: 4 + max: 5 + passed: true + comment: Good use of canvas; map is centered; slight imbalance with legends + on bottom corners + - id: VQ-06 + name: Axis Labels + score: 2 + max: 2 + passed: true + comment: N/A for geographic maps, but legends are well-labeled with Population + (millions) and Region + - id: VQ-07 + name: Grid & Legend + score: 1 + max: 2 + passed: true + comment: Size legend uses consistent symbol color rather than showing varied + colors; legends well-positioned + spec_compliance: + score: 25 + max: 25 + items: + - id: SC-01 + name: Plot Type + score: 8 + max: 8 + passed: true + comment: Correct bubble map with geographic projection + - id: SC-02 + name: Data Mapping + score: 5 + max: 5 + passed: true + comment: Latitude/longitude correctly mapped to positions; population to size; + region to color + - id: SC-03 + name: Required Features + score: 5 + max: 5 + passed: true + comment: 'All spec features present: size encoding, color categories, transparency, + basemap, tooltips, size legend' + - id: SC-04 + name: Data Range + score: 3 + max: 3 + passed: true + comment: All 30 cities visible within map bounds + - id: SC-05 + name: Legend Accuracy + score: 2 + max: 2 + passed: true + comment: Both legends accurate and descriptive + - id: SC-06 + name: Title Format + score: 2 + max: 2 + passed: true + comment: 'Correct format: World City Populations · bubble-map-geographic · + altair · pyplots.ai' + data_quality: + score: 18 + max: 20 + items: + - id: DQ-01 + name: Feature Coverage + score: 7 + max: 8 + passed: true + comment: Shows good range of populations (5.4M to 37.4M), multiple regions, + various geographic distributions; minor deduction for Africa having only + 2 cities + - id: DQ-02 + name: Realistic Context + score: 7 + max: 7 + passed: true + comment: Real world cities with accurate populations and coordinates; neutral + educational topic + - id: DQ-03 + name: Appropriate Scale + score: 4 + max: 5 + passed: true + comment: Population values are realistic; coordinates accurate; minor issue + with some values slightly dated + code_quality: + score: 8 + max: 10 + items: + - id: CQ-01 + name: KISS Structure + score: 3 + max: 3 + passed: true + comment: 'Clean linear flow: imports → data → map → bubbles → combine → save' + - id: CQ-02 + name: Reproducibility + score: 1 + max: 3 + passed: false + comment: No random seed needed (deterministic data), but hardcoded data could + benefit from source comment + - id: CQ-03 + name: Clean Imports + score: 2 + max: 2 + passed: true + comment: Only altair and pandas imported + - id: CQ-04 + name: No Deprecated API + score: 1 + max: 1 + passed: true + comment: Uses current Altair API + - id: CQ-05 + name: Output Correct + score: 1 + max: 1 + passed: true + comment: Saves as plot.png and plot.html + library_features: + score: 5 + max: 5 + items: + - id: LF-01 + name: Distinctive Features + score: 5 + max: 5 + passed: true + comment: 'Excellent use of Altair features: declarative encoding, topo_feature + for basemap, layered composition, interactive tooltips, vega-datasets URL + loading' + verdict: APPROVED +impl_tags: + dependencies: [] + techniques: + - layer-composition + - hover-tooltips + - html-export + - custom-legend + patterns: [] + dataprep: [] + styling: + - alpha-blending + - edge-highlighting