From 586bd82e4caa4569cee1d228fe2db4ada385a0dc Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Sat, 14 Feb 2026 15:43:28 +0100 Subject: [PATCH 1/6] =?UTF-8?q?update(pie-basic):=20pygal=20=E2=80=94=20co?= =?UTF-8?q?mprehensive=20quality=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comprehensive review improving code quality, data choice, visual design, spec compliance, and library feature usage. --- plots/pie-basic/implementations/pygal.py | 38 +++++++++++++----------- plots/pie-basic/metadata/pygal.yaml | 8 ++--- plots/pie-basic/specification.md | 4 ++- plots/pie-basic/specification.yaml | 1 + 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/plots/pie-basic/implementations/pygal.py b/plots/pie-basic/implementations/pygal.py index 66a439d821..c837cd4b83 100644 --- a/plots/pie-basic/implementations/pygal.py +++ b/plots/pie-basic/implementations/pygal.py @@ -1,31 +1,32 @@ -""" pyplots.ai +"""pyplots.ai pie-basic: Basic Pie Chart -Library: pygal 3.1.0 | Python 3.13.11 -Quality: 91/100 | Created: 2025-12-23 +Library: pygal 3.1.0 | Python 3.14.0 +Quality: /100 | Updated: 2026-02-14 """ import pygal from pygal.style import Style -# Data - Market share distribution -categories = ["Product A", "Product B", "Product C", "Product D", "Product E"] -values = [35, 25, 20, 12, 8] +# Data - Global smartphone market share (2024) +companies = ["Apple", "Samsung", "Xiaomi", "OPPO", "vivo", "Others"] +share = [23.3, 19.4, 14.1, 8.7, 7.5, 27.0] -# Custom style for 3600x3600 px (square format for pie chart) +# Custom style for 3600x3600 px (square format) custom_style = Style( background="white", plot_background="white", foreground="#333", - foreground_strong="#333", + foreground_strong="#222", foreground_subtle="#666", - colors=("#306998", "#FFD43B", "#4ECDC4", "#FF6B6B", "#95E1D3"), + colors=("#306998", "#FFD43B", "#4ECDC4", "#FF6B6B", "#95E1D3", "#A78BFA"), title_font_size=72, label_font_size=48, major_label_font_size=48, - legend_font_size=42, - value_font_size=42, + legend_font_size=56, + value_font_size=48, tooltip_font_size=36, + value_colors=("#FFFFFF", "#333333", "#FFFFFF", "#FFFFFF", "#333333", "#FFFFFF"), ) # Create pie chart @@ -33,18 +34,21 @@ width=3600, height=3600, style=custom_style, - title="pie-basic · pygal · pyplots.ai", + title="Smartphone Market Share · pie-basic · pygal · pyplots.ai", inner_radius=0, legend_at_bottom=True, - legend_at_bottom_columns=5, + legend_at_bottom_columns=3, + legend_box_size=36, print_values=True, print_values_position="center", - value_formatter=lambda x: f"{x}%", + value_formatter=lambda x: f"{x:.1f}%", + margin=40, + margin_bottom=100, ) -# Add data slices -for category, value in zip(categories, values, strict=True): - chart.add(category, value) +# Add data with per-slice white stroke borders +for company, value in zip(companies, share, strict=True): + chart.add(company, [{"value": value, "style": "stroke: white; stroke-width: 4"}]) # Save as PNG and HTML chart.render_to_png("plot.png") diff --git a/plots/pie-basic/metadata/pygal.yaml b/plots/pie-basic/metadata/pygal.yaml index 55a07e72b8..459c3f1410 100644 --- a/plots/pie-basic/metadata/pygal.yaml +++ b/plots/pie-basic/metadata/pygal.yaml @@ -1,16 +1,16 @@ library: pygal specification_id: pie-basic created: '2025-12-23T00:35:27Z' -updated: '2025-12-23T00:38:26Z' -generated_by: claude-opus-4-5-20251101 +updated: '2026-02-14T14:40:21+00:00' +generated_by: claude-opus-4-6 workflow_run: 20447776548 issue: 0 -python_version: 3.13.11 +python_version: '3.14.0' library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot.html -quality_score: 91 +quality_score: null impl_tags: dependencies: [] techniques: diff --git a/plots/pie-basic/specification.md b/plots/pie-basic/specification.md index 0ae4d3484e..b335847897 100644 --- a/plots/pie-basic/specification.md +++ b/plots/pie-basic/specification.md @@ -16,10 +16,12 @@ A pie chart showing proportions of categorical data as slices of a circle. Each - `category` (string) - category labels - `value` (numeric) - values for each category - Size: 3-8 categories (too many becomes unreadable) +- Values must be positive and sum to a meaningful whole +- Example: Market share of 5-6 tech companies ## Notes - Include percentage labels on slices - Use distinct colors for each category - Add a legend for category identification -- Consider slight explosion for emphasis on key slice +- Slightly explode the largest or smallest slice for emphasis diff --git a/plots/pie-basic/specification.yaml b/plots/pie-basic/specification.yaml index 0e144ba892..9343ada0fe 100644 --- a/plots/pie-basic/specification.yaml +++ b/plots/pie-basic/specification.yaml @@ -23,3 +23,4 @@ tags: features: - basic - proportional + - comparison From 4dfe8a73f7071a92a78341af1b880b6f57e12636 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Feb 2026 14:47:21 +0000 Subject: [PATCH 2/6] chore(pygal): update quality score 78 and review feedback for pie-basic --- plots/pie-basic/implementations/pygal.py | 4 +- plots/pie-basic/metadata/pygal.yaml | 239 +++++++++++++---------- 2 files changed, 135 insertions(+), 108 deletions(-) diff --git a/plots/pie-basic/implementations/pygal.py b/plots/pie-basic/implementations/pygal.py index c837cd4b83..71aa1f102b 100644 --- a/plots/pie-basic/implementations/pygal.py +++ b/plots/pie-basic/implementations/pygal.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai pie-basic: Basic Pie Chart Library: pygal 3.1.0 | Python 3.14.0 -Quality: /100 | Updated: 2026-02-14 +Quality: 78/100 | Created: 2025-12-23 """ import pygal diff --git a/plots/pie-basic/metadata/pygal.yaml b/plots/pie-basic/metadata/pygal.yaml index 459c3f1410..cbfcb3b7b9 100644 --- a/plots/pie-basic/metadata/pygal.yaml +++ b/plots/pie-basic/metadata/pygal.yaml @@ -1,16 +1,16 @@ library: pygal specification_id: pie-basic created: '2025-12-23T00:35:27Z' -updated: '2026-02-14T14:40:21+00:00' +updated: '2026-02-14T14:47:21Z' generated_by: claude-opus-4-6 workflow_run: 20447776548 issue: 0 -python_version: '3.14.0' +python_version: 3.14.0 library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot.html -quality_score: null +quality_score: 78 impl_tags: dependencies: [] techniques: @@ -18,137 +18,156 @@ impl_tags: patterns: - iteration-over-groups dataprep: [] - styling: [] + styling: + - edge-highlighting review: strengths: - - Clean, readable code following KISS principles with clear section comments - - Excellent color palette with good contrast and colorblind accessibility - - Proper use of pygal Style class for comprehensive customization - - Percentage labels are well-positioned and clearly readable inside slices + - Realistic smartphone market share data with plausible values summing to 100% - Correct title format following pyplots.ai conventions - - Generates both PNG and HTML outputs for flexibility + - Good use of pygal-specific features (value_formatter, print_values_position, per-slice + SVG styling) + - Clean KISS code structure with explicit font sizing + - White stroke borders between slices add visual polish weaknesses: - - Legend at bottom appears relatively small compared to the pie chart; could increase - legend_font_size for better readability - - Missing slight explosion for emphasis on key slice as suggested in the specification - notes - image_description: 'The plot displays a pie chart showing market share distribution - across 5 products. The chart uses a square format (3600x3600px) with distinct - colors: blue (#306998) for Product A (35%), yellow (#FFD43B) for Product B (25%), - teal (#4ECDC4) for Product C (20%), coral/red (#FF6B6B) for Product D (12%), and - mint green (#95E1D3) for Product E (8%). Each slice displays its percentage value - centered within the slice. The title "pie-basic · pygal · pyplots.ai" appears - at the top in dark gray text. A horizontal legend at the bottom identifies all - 5 products with their corresponding color indicators arranged in 5 columns.' + - Missing exploded slice — spec explicitly requires slightly explode the largest + or smallest slice for emphasis + - 'No data storytelling: add an annotation or visual emphasis highlighting key insight + such as Others dominance or market leader' + - value_colors in Style is not a valid pygal attribute — remove this dead code + - Design could be elevated with a more intentional color narrative or annotation + pointing out the key insight + image_description: 'The plot displays a pie chart titled "Smartphone Market Share + · pie-basic · pygal · pyplots.ai" on a white background. Six slices represent + global smartphone market share: Apple (23.3%, steel blue), Samsung (19.4%, soft + gold/yellow), Xiaomi (14.1%, light teal), OPPO (8.7%, coral/salmon), vivo (7.5%, + mint green), and Others (27.0%, light lavender/purple). Percentage labels are + centered on each slice in white or dark text. A legend at the bottom arranges + all six categories in a 3-column layout. White stroke borders separate the slices. + No slice is exploded. The pie fills most of the square canvas (3600x3600 px). + The rendered colors appear more pastel than the hex values defined in code.' criteria_checklist: visual_quality: - score: 36 - max: 40 + score: 26 + max: 30 items: - id: VQ-01 name: Text Legibility - score: 10 - max: 10 + score: 7 + max: 8 passed: true - comment: Title and percentage labels are clearly readable at the large canvas - size + comment: Font sizes explicitly set; all text readable. Legend text slightly + small relative to chart size. - id: VQ-02 name: No Overlap - score: 8 - max: 8 + score: 6 + max: 6 passed: true - comment: No overlapping text elements; percentages are well-positioned within - slices + comment: No overlapping text elements. - id: VQ-03 name: Element Visibility - score: 8 - max: 8 + score: 5 + max: 6 passed: true - comment: Pie slices are well-proportioned and clearly visible + comment: All slices visible; white stroke borders aid separation. Smaller + slices are narrow but readable. - id: VQ-04 name: Color Accessibility - score: 5 - max: 5 + score: 3 + max: 4 passed: true - comment: Colors are distinct and colorblind-friendly (no red-green as only - difference) + comment: Distinguishable palette with no red-green confusion. Pastel rendering + slightly reduces contrast. - id: VQ-05 name: Layout Balance score: 3 - max: 5 + max: 4 passed: true - comment: Good overall layout, but legend at bottom appears small relative - to chart - - id: VQ-07 - name: Grid & Legend - score: 0 + comment: Pie fills canvas well; legend at bottom. Some unused whitespace below + legend. + - id: VQ-06 + name: Axis Labels & Title + score: 2 max: 2 + passed: true + comment: Descriptive title with proper format. No axis labels needed for pie + chart. + design_excellence: + score: 9 + max: 20 + items: + - id: DE-01 + name: Aesthetic Sophistication + score: 4 + max: 8 passed: false - comment: Legend text appears quite small compared to the chart; could be more - prominent + comment: Custom palette with white stroke borders; looks polished but like + a well-configured default, not publication-level. + - id: DE-02 + name: Visual Refinement + score: 3 + max: 6 + passed: false + comment: White stroke borders, clean background, bottom legend in columns. + Some refinement but not heavily polished. + - id: DE-03 + name: Data Storytelling + score: 2 + max: 6 + passed: false + comment: Data displayed clearly but no annotations, callouts, or emphasis + guiding the viewer to key insights. spec_compliance: - score: 25 - max: 25 + score: 13 + max: 15 items: - id: SC-01 name: Plot Type - score: 8 - max: 8 - passed: true - comment: Correct pie chart type - - id: SC-02 - name: Data Mapping score: 5 max: 5 passed: true - comment: Categories and values correctly mapped to slices - - id: SC-03 + comment: Correct pie chart type. + - id: SC-02 name: Required Features - score: 5 - max: 5 + score: 2 + max: 4 + passed: false + comment: Has percentage labels, distinct colors, and legend. Missing exploded + slice as required by spec. + - id: SC-03 + name: Data Mapping + score: 3 + max: 3 passed: true - comment: Includes percentage labels, distinct colors, and legend as specified + comment: Categories and values correctly mapped. - id: SC-04 - name: Data Range + name: Title & Legend score: 3 max: 3 passed: true - comment: All data visible, percentages sum to 100% - - id: SC-05 - name: Legend Accuracy - score: 2 - max: 2 - passed: true - comment: Legend correctly identifies all categories - - id: SC-06 - name: Title Format - score: 2 - max: 2 - passed: true - comment: 'Uses correct format: "pie-basic · pygal · pyplots.ai"' + comment: Title follows correct format. Legend labels match data. data_quality: - score: 18 - 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 different sized slices demonstrating proportions, but missing - "explosion" feature mentioned in spec notes + comment: 'Good variety of slice sizes: large, medium, and small slices represented.' - id: DQ-02 name: Realistic Context - score: 7 - max: 7 + score: 5 + max: 5 passed: true - comment: Market share distribution is a realistic, comprehensible scenario + comment: Global smartphone market share is a real, neutral, comprehensible + business scenario. - id: DQ-03 name: Appropriate Scale - score: 5 - max: 5 + score: 4 + max: 4 passed: true - comment: Values (35%, 25%, 20%, 12%, 8%) are realistic for market share + comment: Values sum to 100% and reflect plausible 2024 market share figures. code_quality: score: 9 max: 10 @@ -158,40 +177,48 @@ review: score: 3 max: 3 passed: true - comment: Simple imports → data → plot → save structure, no functions/classes + comment: 'Clean flow: imports, data, style, chart, save.' - id: CQ-02 name: Reproducibility - score: 3 - max: 3 + score: 2 + max: 2 passed: true - comment: Deterministic data (no random elements) + comment: Deterministic hardcoded data. - id: CQ-03 name: Clean Imports score: 2 max: 2 passed: true - comment: Only pygal and Style imported, both used + comment: Only pygal and Style, both used. - id: CQ-04 - name: No Deprecated API + name: Code Elegance + score: 1 + max: 2 + passed: false + comment: value_colors in Style is not a valid pygal Style attribute — dead + code. + - id: CQ-05 + name: Output & API score: 1 max: 1 passed: true - comment: Uses current pygal API - - id: CQ-05 - name: Output Correct - score: 0 - max: 0 - passed: false - comment: Saves as plot.png correctly - library_features: - score: 3 - max: 5 + comment: Saves as plot.png and plot.html. + library_mastery: + score: 7 + max: 10 items: - - id: LF-01 - name: Uses distinctive library features + - id: LM-01 + name: Idiomatic Usage + score: 4 + max: 5 + passed: true + comment: Good use of pygal Pie class, Style, print_values, value_formatter, + legend options. + - id: LM-02 + name: Distinctive Features score: 3 max: 5 passed: true - comment: Uses pygal's Style customization and render_to_png/render_to_file, - but doesn't use unique features like hover interactivity or half-pie mode - verdict: APPROVED + comment: 'Uses pygal-specific features: print_values_position, value_formatter + lambda, legend_at_bottom_columns, per-slice SVG style strings.' + verdict: REJECTED From 14bf54a0b5aebaf0822a733f325ef1281474ef32 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Feb 2026 14:57:16 +0000 Subject: [PATCH 3/6] fix(pygal): address review feedback for pie-basic Attempt 1/3 - fixes based on AI review --- plots/pie-basic/implementations/pygal.py | 70 +++++++++++++++++------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/plots/pie-basic/implementations/pygal.py b/plots/pie-basic/implementations/pygal.py index 71aa1f102b..cb700a8920 100644 --- a/plots/pie-basic/implementations/pygal.py +++ b/plots/pie-basic/implementations/pygal.py @@ -1,35 +1,52 @@ -""" pyplots.ai +"""pyplots.ai pie-basic: Basic Pie Chart Library: pygal 3.1.0 | Python 3.14.0 -Quality: 78/100 | Created: 2025-12-23 """ +import math + import pygal from pygal.style import Style # Data - Global smartphone market share (2024) -companies = ["Apple", "Samsung", "Xiaomi", "OPPO", "vivo", "Others"] -share = [23.3, 19.4, 14.1, 8.7, 7.5, 27.0] +categories = [("Apple", 23.3), ("Samsung", 19.4), ("Xiaomi", 14.1), ("OPPO", 8.7), ("vivo", 7.5), ("Others", 27.0)] + +# Identify the largest slice for explosion (spec: "explode largest or smallest") +values = [v for _, v in categories] +largest_idx = values.index(max(values)) + +# Calculate explode offset — pygal draws slices clockwise from top (−π/2). +# Compute the angular bisector of the largest slice to translate it outward. +total = sum(values) +cumulative_before = sum(values[:largest_idx]) +slice_mid_frac = (cumulative_before + values[largest_idx] / 2) / total +mid_angle = -math.pi / 2 + slice_mid_frac * 2 * math.pi +explode_px = 30 +explode_dx = math.cos(mid_angle) * explode_px +explode_dy = math.sin(mid_angle) * explode_px + +# Saturated, high-contrast palette — colorblind-safe (no red-green ambiguity) +palette = ("#2563EB", "#D97706", "#0D9488", "#E11D48", "#7C3AED", "#475569") -# Custom style for 3600x3600 px (square format) custom_style = Style( background="white", plot_background="white", - foreground="#333", - foreground_strong="#222", - foreground_subtle="#666", - colors=("#306998", "#FFD43B", "#4ECDC4", "#FF6B6B", "#95E1D3", "#A78BFA"), + foreground="#1E293B", + foreground_strong="#0F172A", + foreground_subtle="#94A3B8", + colors=palette, title_font_size=72, - label_font_size=48, - major_label_font_size=48, - legend_font_size=56, - value_font_size=48, + label_font_size=44, + major_label_font_size=44, + value_label_font_size=40, + legend_font_size=52, + value_font_size=52, tooltip_font_size=36, - value_colors=("#FFFFFF", "#333333", "#FFFFFF", "#FFFFFF", "#333333", "#FFFFFF"), + value_colors=("#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF"), + stroke_opacity=1, ) -# Create pie chart chart = pygal.Pie( width=3600, height=3600, @@ -40,16 +57,29 @@ legend_at_bottom_columns=3, legend_box_size=36, print_values=True, + print_labels=True, print_values_position="center", value_formatter=lambda x: f"{x:.1f}%", margin=40, - margin_bottom=100, + margin_bottom=80, ) -# Add data with per-slice white stroke borders -for company, value in zip(companies, share, strict=True): - chart.add(company, [{"value": value, "style": "stroke: white; stroke-width: 4"}]) +# Storytelling: legend names convey narrative; labels add on-chart annotations +legend_names = {"Others": "Others (largest share)", "Apple": "Apple (top brand)"} + +for i, (company, value) in enumerate(categories): + slice_css = "stroke: white; stroke-width: 5" + slice_data = {"value": value, "style": slice_css} + + # Explode the largest slice outward for emphasis + if i == largest_idx: + slice_data["node"] = {"transform": f"translate({explode_dx:.1f}, {explode_dy:.1f})"} + slice_data["label"] = "Largest" + elif company == "Apple": + slice_data["label"] = "#1 brand" + + name = legend_names.get(company, company) + chart.add(name, [slice_data]) -# Save as PNG and HTML chart.render_to_png("plot.png") chart.render_to_file("plot.html") From f05f885da1cc60c6f23816c60159ace7242cb015 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Feb 2026 15:01:38 +0000 Subject: [PATCH 4/6] chore(pygal): update quality score 86 and review feedback for pie-basic --- plots/pie-basic/implementations/pygal.py | 3 +- plots/pie-basic/metadata/pygal.yaml | 157 ++++++++++++----------- 2 files changed, 85 insertions(+), 75 deletions(-) diff --git a/plots/pie-basic/implementations/pygal.py b/plots/pie-basic/implementations/pygal.py index cb700a8920..6c056fe427 100644 --- a/plots/pie-basic/implementations/pygal.py +++ b/plots/pie-basic/implementations/pygal.py @@ -1,6 +1,7 @@ -"""pyplots.ai +""" pyplots.ai pie-basic: Basic Pie Chart Library: pygal 3.1.0 | Python 3.14.0 +Quality: 86/100 | Created: 2025-12-23 """ import math diff --git a/plots/pie-basic/metadata/pygal.yaml b/plots/pie-basic/metadata/pygal.yaml index cbfcb3b7b9..14d471e66a 100644 --- a/plots/pie-basic/metadata/pygal.yaml +++ b/plots/pie-basic/metadata/pygal.yaml @@ -1,7 +1,7 @@ library: pygal specification_id: pie-basic created: '2025-12-23T00:35:27Z' -updated: '2026-02-14T14:47:21Z' +updated: '2026-02-14T15:01:38Z' generated_by: claude-opus-4-6 workflow_run: 20447776548 issue: 0 @@ -10,10 +10,11 @@ library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot.html -quality_score: 78 +quality_score: 86 impl_tags: dependencies: [] techniques: + - annotations - html-export patterns: - iteration-over-groups @@ -22,32 +23,40 @@ impl_tags: - edge-highlighting review: strengths: - - Realistic smartphone market share data with plausible values summing to 100% - - Correct title format following pyplots.ai conventions - - Good use of pygal-specific features (value_formatter, print_values_position, per-slice - SVG styling) - - Clean KISS code structure with explicit font sizing - - White stroke borders between slices add visual polish + - Excellent spec compliance — all required features (percentages, legend, distinct + colors, exploded slice) are present and working + - Thoughtful data storytelling with narrative legend names and on-slice annotations + (#1 brand, Largest) + - Creative use of pygal SVG node manipulation for slice explosion — a library-distinctive + technique + - Colorblind-safe palette with good contrast between all six slices + - Realistic, neutral data scenario (smartphone market share) with accurate values weaknesses: - - Missing exploded slice — spec explicitly requires slightly explode the largest - or smallest slice for emphasis - - 'No data storytelling: add an annotation or visual emphasis highlighting key insight - such as Others dominance or market leader' - - value_colors in Style is not a valid pygal attribute — remove this dead code - - Design could be elevated with a more intentional color narrative or annotation - pointing out the key insight - image_description: 'The plot displays a pie chart titled "Smartphone Market Share - · pie-basic · pygal · pyplots.ai" on a white background. Six slices represent - global smartphone market share: Apple (23.3%, steel blue), Samsung (19.4%, soft - gold/yellow), Xiaomi (14.1%, light teal), OPPO (8.7%, coral/salmon), vivo (7.5%, - mint green), and Others (27.0%, light lavender/purple). Percentage labels are - centered on each slice in white or dark text. A legend at the bottom arranges - all six categories in a 3-column layout. White stroke borders separate the slices. - No slice is exploded. The pie fills most of the square canvas (3600x3600 px). - The rendered colors appear more pastel than the hex values defined in code.' + - The trigonometric explosion calculation (~10 lines of math) is over-engineered + — consider simplifying the approach or using a fixed translate offset + - The exploded Others slice creates a visible gap that makes the pie chart feel + off-center within the canvas + - Legend text at the bottom appears somewhat small relative to the 3600px canvas + despite explicit font sizing + - The Largest annotation on the Others slice is generic — a more descriptive label + would strengthen the storytelling + - Smaller slices (OPPO at 8.7%, vivo at 7.5%) could benefit from slightly larger + label text for better readability + image_description: 'The plot is a 3600x3600 px pie chart on a white background. + The title "Smartphone Market Share · pie-basic · pygal · pyplots.ai" appears at + the top in dark text. Six slices represent smartphone brands: Apple (blue, 23.3%), + Samsung (orange, 19.4%), Xiaomi (teal, 14.1%), OPPO (pink/rose, 8.7%), vivo (purple, + 7.5%), and Others (slate gray, 27.0%). The "Others" slice is exploded outward + for emphasis via an SVG transform, creating a visible gap. White stroke borders + separate each slice. Percentage labels appear in white text centered on each slice. + The Apple slice carries a "#1 brand" annotation and the Others slice shows "Largest." + A legend at the bottom is arranged in 3 columns with narrative names: "Apple (top + brand)", "Samsung", "Xiaomi", "OPPO", "vivo", "Others (largest share)." The color + palette uses saturated, high-contrast hues (blue, orange, teal, pink, purple, + gray) that avoid red-green ambiguity.' criteria_checklist: visual_quality: - score: 26 + score: 27 max: 30 items: - id: VQ-01 @@ -55,69 +64,67 @@ review: score: 7 max: 8 passed: true - comment: Font sizes explicitly set; all text readable. Legend text slightly - small relative to chart size. + comment: Font sizes explicitly set (title 72, labels 44, legend 52, values + 52). All text readable. Legend at bottom slightly small relative to canvas. - id: VQ-02 name: No Overlap score: 6 max: 6 passed: true - comment: No overlapping text elements. + comment: No overlapping text elements anywhere. - id: VQ-03 name: Element Visibility score: 5 max: 6 passed: true - comment: All slices visible; white stroke borders aid separation. Smaller - slices are narrow but readable. + comment: Slices well-sized; OPPO and vivo slices are small but still clearly + visible. - id: VQ-04 name: Color Accessibility - score: 3 + score: 4 max: 4 passed: true - comment: Distinguishable palette with no red-green confusion. Pastel rendering - slightly reduces contrast. + comment: Colorblind-safe palette with no red-green ambiguity. - id: VQ-05 name: Layout Balance score: 3 max: 4 passed: true - comment: Pie fills canvas well; legend at bottom. Some unused whitespace below - legend. + comment: Pie fills good portion of canvas but exploded slice creates off-center + appearance. - id: VQ-06 name: Axis Labels & Title score: 2 max: 2 passed: true - comment: Descriptive title with proper format. No axis labels needed for pie - chart. + comment: Descriptive title with context. Pie charts have no axes. design_excellence: - score: 9 + score: 14 max: 20 items: - id: DE-01 name: Aesthetic Sophistication - score: 4 + score: 6 max: 8 - passed: false - comment: Custom palette with white stroke borders; looks polished but like - a well-configured default, not publication-level. + passed: true + comment: Custom saturated palette, white stroke borders, narrative legend + names. Clearly above defaults. - id: DE-02 name: Visual Refinement - score: 3 + score: 4 max: 6 - passed: false - comment: White stroke borders, clean background, bottom legend in columns. - Some refinement but not heavily polished. + passed: true + comment: Clean white background, stroke separators, tidy legend. Explosion + gap is somewhat distracting. - id: DE-03 name: Data Storytelling - score: 2 + score: 4 max: 6 - passed: false - comment: Data displayed clearly but no annotations, callouts, or emphasis - guiding the viewer to key insights. + passed: true + comment: Narrative legend names and on-slice annotations guide the reader. + Could be stronger with more context. spec_compliance: - score: 13 + score: 15 max: 15 items: - id: SC-01 @@ -128,11 +135,11 @@ review: comment: Correct pie chart type. - id: SC-02 name: Required Features - score: 2 + score: 4 max: 4 - passed: false - comment: Has percentage labels, distinct colors, and legend. Missing exploded - slice as required by spec. + passed: true + comment: 'All spec features present: percentage labels, distinct colors, legend, + exploded slice.' - id: SC-03 name: Data Mapping score: 3 @@ -144,7 +151,8 @@ review: score: 3 max: 3 passed: true - comment: Title follows correct format. Legend labels match data. + comment: Title follows correct format. Legend labels match data with narrative + enhancements. data_quality: score: 14 max: 15 @@ -154,57 +162,58 @@ review: score: 5 max: 6 passed: true - comment: 'Good variety of slice sizes: large, medium, and small slices represented.' + comment: Shows variety in slice sizes, includes Others aggregation, and has + exploded emphasis. - id: DQ-02 name: Realistic Context score: 5 max: 5 passed: true - comment: Global smartphone market share is a real, neutral, comprehensible - business scenario. + comment: Global smartphone market share is a real, recognizable, neutral business + scenario. - id: DQ-03 name: Appropriate Scale score: 4 max: 4 passed: true - comment: Values sum to 100% and reflect plausible 2024 market share figures. + comment: Values are realistic and sum to 100%. code_quality: - score: 9 + score: 8 max: 10 items: - id: CQ-01 name: KISS Structure - score: 3 + score: 2 max: 3 passed: true - comment: 'Clean flow: imports, data, style, chart, save.' + comment: Flat script structure but manual trigonometric explosion calculation + adds complexity. - id: CQ-02 name: Reproducibility score: 2 max: 2 passed: true - comment: Deterministic hardcoded data. + comment: Deterministic hardcoded data, no randomness. - id: CQ-03 name: Clean Imports score: 2 max: 2 passed: true - comment: Only pygal and Style, both used. + comment: All imports (math, pygal, Style) are used. - id: CQ-04 name: Code Elegance score: 1 max: 2 - passed: false - comment: value_colors in Style is not a valid pygal Style attribute — dead - code. + passed: true + comment: Angular bisector calculation for SVG explosion is clever but over-engineered. - id: CQ-05 name: Output & API score: 1 max: 1 passed: true - comment: Saves as plot.png and plot.html. + comment: Saves plot.png and plot.html correctly. library_mastery: - score: 7 + score: 8 max: 10 items: - id: LM-01 @@ -213,12 +222,12 @@ review: max: 5 passed: true comment: Good use of pygal Pie class, Style, print_values, value_formatter, - legend options. + legend_at_bottom. - id: LM-02 name: Distinctive Features - score: 3 + score: 4 max: 5 passed: true - comment: 'Uses pygal-specific features: print_values_position, value_formatter - lambda, legend_at_bottom_columns, per-slice SVG style strings.' + comment: Uses pygal-specific SVG node manipulation for explosion, value_colors, + print_values_position. verdict: REJECTED From 2c51fed2537be89f0972fd992271351e7dc81421 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Feb 2026 15:04:54 +0000 Subject: [PATCH 5/6] fix(pygal): address review feedback for pie-basic Attempt 2/3 - fixes based on AI review --- plots/pie-basic/implementations/pygal.py | 51 +++++++++--------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/plots/pie-basic/implementations/pygal.py b/plots/pie-basic/implementations/pygal.py index 6c056fe427..2a2433aef5 100644 --- a/plots/pie-basic/implementations/pygal.py +++ b/plots/pie-basic/implementations/pygal.py @@ -1,11 +1,9 @@ -""" pyplots.ai +"""pyplots.ai pie-basic: Basic Pie Chart Library: pygal 3.1.0 | Python 3.14.0 Quality: 86/100 | Created: 2025-12-23 """ -import math - import pygal from pygal.style import Style @@ -13,22 +11,8 @@ # Data - Global smartphone market share (2024) categories = [("Apple", 23.3), ("Samsung", 19.4), ("Xiaomi", 14.1), ("OPPO", 8.7), ("vivo", 7.5), ("Others", 27.0)] -# Identify the largest slice for explosion (spec: "explode largest or smallest") -values = [v for _, v in categories] -largest_idx = values.index(max(values)) - -# Calculate explode offset — pygal draws slices clockwise from top (−π/2). -# Compute the angular bisector of the largest slice to translate it outward. -total = sum(values) -cumulative_before = sum(values[:largest_idx]) -slice_mid_frac = (cumulative_before + values[largest_idx] / 2) / total -mid_angle = -math.pi / 2 + slice_mid_frac * 2 * math.pi -explode_px = 30 -explode_dx = math.cos(mid_angle) * explode_px -explode_dy = math.sin(mid_angle) * explode_px - # Saturated, high-contrast palette — colorblind-safe (no red-green ambiguity) -palette = ("#2563EB", "#D97706", "#0D9488", "#E11D48", "#7C3AED", "#475569") +palette = ("#2563EB", "#D97706", "#0D9488", "#E11D48", "#7C3AED", "#64748B") custom_style = Style( background="white", @@ -37,12 +21,12 @@ foreground_strong="#0F172A", foreground_subtle="#94A3B8", colors=palette, - title_font_size=72, - label_font_size=44, - major_label_font_size=44, - value_label_font_size=40, - legend_font_size=52, - value_font_size=52, + title_font_size=76, + label_font_size=48, + major_label_font_size=48, + value_label_font_size=44, + legend_font_size=60, + value_font_size=56, tooltip_font_size=36, value_colors=("#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF"), stroke_opacity=1, @@ -56,25 +40,26 @@ inner_radius=0, legend_at_bottom=True, legend_at_bottom_columns=3, - legend_box_size=36, + legend_box_size=40, print_values=True, print_labels=True, print_values_position="center", value_formatter=lambda x: f"{x:.1f}%", - margin=40, - margin_bottom=80, + margin=60, + margin_bottom=100, + truncate_legend=-1, ) -# Storytelling: legend names convey narrative; labels add on-chart annotations -legend_names = {"Others": "Others (largest share)", "Apple": "Apple (top brand)"} +# Storytelling: narrative legend names convey insight; on-slice labels add context +legend_names = {"Others": "Others (largest segment)", "Apple": "Apple (#1 brand)", "Samsung": "Samsung (#2 worldwide)"} -for i, (company, value) in enumerate(categories): +for company, value in categories: slice_css = "stroke: white; stroke-width: 5" slice_data = {"value": value, "style": slice_css} - # Explode the largest slice outward for emphasis - if i == largest_idx: - slice_data["node"] = {"transform": f"translate({explode_dx:.1f}, {explode_dy:.1f})"} + # Explode the largest slice ("Others") with a subtle fixed offset for emphasis + if company == "Others": + slice_data["node"] = {"transform": "translate(0, -18)"} slice_data["label"] = "Largest" elif company == "Apple": slice_data["label"] = "#1 brand" From 278b9d704870d9d67c5b8436c4e982829478bb84 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Feb 2026 15:08:45 +0000 Subject: [PATCH 6/6] chore(pygal): update quality score 90 and review feedback for pie-basic --- plots/pie-basic/implementations/pygal.py | 4 +- plots/pie-basic/metadata/pygal.yaml | 146 +++++++++++------------ 2 files changed, 71 insertions(+), 79 deletions(-) diff --git a/plots/pie-basic/implementations/pygal.py b/plots/pie-basic/implementations/pygal.py index 2a2433aef5..57d40d0239 100644 --- a/plots/pie-basic/implementations/pygal.py +++ b/plots/pie-basic/implementations/pygal.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai pie-basic: Basic Pie Chart Library: pygal 3.1.0 | Python 3.14.0 -Quality: 86/100 | Created: 2025-12-23 +Quality: 90/100 | Created: 2025-12-23 """ import pygal diff --git a/plots/pie-basic/metadata/pygal.yaml b/plots/pie-basic/metadata/pygal.yaml index 14d471e66a..88a27f8916 100644 --- a/plots/pie-basic/metadata/pygal.yaml +++ b/plots/pie-basic/metadata/pygal.yaml @@ -1,7 +1,7 @@ library: pygal specification_id: pie-basic created: '2025-12-23T00:35:27Z' -updated: '2026-02-14T15:01:38Z' +updated: '2026-02-14T15:08:44Z' generated_by: claude-opus-4-6 workflow_run: 20447776548 issue: 0 @@ -10,11 +10,10 @@ library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/pie-basic/pygal/plot.html -quality_score: 86 +quality_score: 90 impl_tags: dependencies: [] techniques: - - annotations - html-export patterns: - iteration-over-groups @@ -23,37 +22,30 @@ impl_tags: - edge-highlighting review: strengths: - - Excellent spec compliance — all required features (percentages, legend, distinct - colors, exploded slice) are present and working - - Thoughtful data storytelling with narrative legend names and on-slice annotations - (#1 brand, Largest) - - Creative use of pygal SVG node manipulation for slice explosion — a library-distinctive - technique - - Colorblind-safe palette with good contrast between all six slices - - Realistic, neutral data scenario (smartphone market share) with accurate values + - Excellent data storytelling through enriched legend names and on-slice contextual + labels that guide the viewer + - Strong colorblind-safe palette with good visual separation via white stroke between + slices + - Creative use of pygal SVG node transform for slice explosion effect — distinctly + pygal approach + - Clean flat code structure with deterministic data and no unnecessary dependencies + - Perfect spec compliance with all four required features implemented weaknesses: - - The trigonometric explosion calculation (~10 lines of math) is over-engineered - — consider simplifying the approach or using a fixed translate offset - - The exploded Others slice creates a visible gap that makes the pie chart feel - off-center within the canvas - - Legend text at the bottom appears somewhat small relative to the 3600px canvas - despite explicit font sizing - - The Largest annotation on the Others slice is generic — a more descriptive label - would strengthen the storytelling - - Smaller slices (OPPO at 8.7%, vivo at 7.5%) could benefit from slightly larger - label text for better readability - image_description: 'The plot is a 3600x3600 px pie chart on a white background. - The title "Smartphone Market Share · pie-basic · pygal · pyplots.ai" appears at - the top in dark text. Six slices represent smartphone brands: Apple (blue, 23.3%), - Samsung (orange, 19.4%), Xiaomi (teal, 14.1%), OPPO (pink/rose, 8.7%), vivo (purple, - 7.5%), and Others (slate gray, 27.0%). The "Others" slice is exploded outward - for emphasis via an SVG transform, creating a visible gap. White stroke borders - separate each slice. Percentage labels appear in white text centered on each slice. - The Apple slice carries a "#1 brand" annotation and the Others slice shows "Largest." - A legend at the bottom is arranged in 3 columns with narrative names: "Apple (top - brand)", "Samsung", "Xiaomi", "OPPO", "vivo", "Others (largest share)." The color - palette uses saturated, high-contrast hues (blue, orange, teal, pink, purple, - gray) that avoid red-green ambiguity.' + - Minor label crowding in the OPPO and vivo small slices — tight but still readable + - Slight excess whitespace above the title area + - Monospace font rendering from pygal SVG-to-PNG pipeline is functional but not + as polished as proportional fonts + image_description: 'The plot shows a pie chart on a white 3600x3600 background titled + "Smartphone Market Share · pie-basic · pygal · pyplots.ai" at the top in dark + text. Six slices represent global smartphone market share: Apple (blue, 23.3%), + Samsung (orange, 19.4%), Xiaomi (teal, 14.1%), OPPO (rose/pink, 8.7%), vivo (purple, + 7.5%), and Others (gray, 27.0%). Each slice displays a white percentage label. + The "Others" slice is slightly exploded outward for emphasis. Apple''s slice carries + an additional "#1 brand" label and the Others slice shows "Largest." White strokes + separate all slices. A bottom legend in two rows of three uses enriched names: + "Apple (#1 brand)", "Samsung (#2 worldwide)", "Xiaomi", "OPPO", "vivo", "Others + (largest segment)." Colors are distinct and colorblind-safe (blue, amber, teal, + rose, purple, gray).' criteria_checklist: visual_quality: score: 27 @@ -64,42 +56,43 @@ review: score: 7 max: 8 passed: true - comment: Font sizes explicitly set (title 72, labels 44, legend 52, values - 52). All text readable. Legend at bottom slightly small relative to canvas. + comment: All font sizes explicitly set (title 76, labels 48, legend 60, values + 56). Readable throughout, minor cramping in small slices. - id: VQ-02 name: No Overlap - score: 6 + score: 5 max: 6 passed: true - comment: No overlapping text elements anywhere. + comment: No actual text overlap. Percentage labels for OPPO and vivo in tight + slices but remain readable. - id: VQ-03 name: Element Visibility - score: 5 + score: 6 max: 6 passed: true - comment: Slices well-sized; OPPO and vivo slices are small but still clearly - visible. + comment: All slices clearly visible, white stroke provides excellent slice + delineation. - id: VQ-04 name: Color Accessibility score: 4 max: 4 passed: true - comment: Colorblind-safe palette with no red-green ambiguity. + comment: Colorblind-safe palette avoiding red-green ambiguity. - id: VQ-05 name: Layout Balance score: 3 max: 4 passed: true - comment: Pie fills good portion of canvas but exploded slice creates off-center - appearance. + comment: Pie fills canvas well, legend at bottom in 3 columns. Slight excess + whitespace at top. - id: VQ-06 name: Axis Labels & Title score: 2 max: 2 passed: true - comment: Descriptive title with context. Pie charts have no axes. + comment: Descriptive title with context. No axes needed for pie chart. design_excellence: - score: 14 + score: 15 max: 20 items: - id: DE-01 @@ -107,22 +100,22 @@ review: score: 6 max: 8 passed: true - comment: Custom saturated palette, white stroke borders, narrative legend - names. Clearly above defaults. + comment: Custom palette, white stroke separation, intentional typography hierarchy, + enriched legend names. Above default but not FiveThirtyEight-level. - id: DE-02 name: Visual Refinement score: 4 max: 6 passed: true - comment: Clean white background, stroke separators, tidy legend. Explosion - gap is somewhat distracting. + comment: Clean white background, no unnecessary chrome, custom margins, well-organized + bottom legend. - id: DE-03 name: Data Storytelling - score: 4 + score: 5 max: 6 passed: true - comment: Narrative legend names and on-slice annotations guide the reader. - Could be stronger with more context. + comment: Enriched legend names convey narrative, on-slice labels, exploded + largest slice draws attention. spec_compliance: score: 15 max: 15 @@ -138,21 +131,21 @@ review: score: 4 max: 4 passed: true - comment: 'All spec features present: percentage labels, distinct colors, legend, - exploded slice.' + comment: Percentage labels, distinct colors, legend, exploded slice — all + present. - id: SC-03 name: Data Mapping score: 3 max: 3 passed: true - comment: Categories and values correctly mapped. + comment: Categories mapped to slices, values to proportional angles. - id: SC-04 name: Title & Legend score: 3 max: 3 passed: true - comment: Title follows correct format. Legend labels match data with narrative - enhancements. + comment: Title follows required format. Legend labels correctly identify all + categories. data_quality: score: 14 max: 15 @@ -162,32 +155,30 @@ review: score: 5 max: 6 passed: true - comment: Shows variety in slice sizes, includes Others aggregation, and has - exploded emphasis. + comment: Good variation in slice sizes (7.5% to 27%), includes Others aggregation. - id: DQ-02 name: Realistic Context score: 5 max: 5 passed: true - comment: Global smartphone market share is a real, recognizable, neutral business - scenario. + comment: Global smartphone market share 2024 with recognizable companies. + Neutral business scenario. - id: DQ-03 name: Appropriate Scale score: 4 max: 4 passed: true - comment: Values are realistic and sum to 100%. + comment: Values sum to 100%, realistic market share percentages. code_quality: - score: 8 + score: 10 max: 10 items: - id: CQ-01 name: KISS Structure - score: 2 + score: 3 max: 3 passed: true - comment: Flat script structure but manual trigonometric explosion calculation - adds complexity. + comment: 'Flat script: imports, data, style, chart config, loop, render.' - id: CQ-02 name: Reproducibility score: 2 @@ -199,35 +190,36 @@ review: score: 2 max: 2 passed: true - comment: All imports (math, pygal, Style) are used. + comment: Only pygal and pygal.style.Style imported, both used. - id: CQ-04 name: Code Elegance - score: 1 + score: 2 max: 2 passed: true - comment: Angular bisector calculation for SVG explosion is clever but over-engineered. + comment: Clean loop with dict-based slice config. Creative SVG node transform + for explode. - id: CQ-05 name: Output & API score: 1 max: 1 passed: true - comment: Saves plot.png and plot.html correctly. + comment: Saves as plot.png and plot.html. library_mastery: - score: 8 + score: 9 max: 10 items: - id: LM-01 name: Idiomatic Usage - score: 4 + score: 5 max: 5 passed: true - comment: Good use of pygal Pie class, Style, print_values, value_formatter, - legend_at_bottom. + comment: Uses pygal Pie class, Style, print_values, value_formatter, legend_at_bottom_columns, + render_to_png. - id: LM-02 name: Distinctive Features score: 4 max: 5 passed: true - comment: Uses pygal-specific SVG node manipulation for explosion, value_colors, - print_values_position. - verdict: REJECTED + comment: SVG node manipulation for exploding slices, value_formatter lambda, + value_colors, truncate_legend, dual output. + verdict: APPROVED