From 5471f245a5772e79a8c07e2431a73913150ade8b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Dec 2025 10:38:43 +0000 Subject: [PATCH 1/3] feat(pygal): implement histogram-stacked --- .../implementations/pygal.py | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 plots/histogram-stacked/implementations/pygal.py diff --git a/plots/histogram-stacked/implementations/pygal.py b/plots/histogram-stacked/implementations/pygal.py new file mode 100644 index 0000000000..d80712ea26 --- /dev/null +++ b/plots/histogram-stacked/implementations/pygal.py @@ -0,0 +1,73 @@ +"""pyplots.ai +histogram-stacked: Stacked Histogram +Library: pygal | Python 3.13 +Quality: pending | Created: 2025-12-30 +""" + +import numpy as np +import pygal +from pygal.style import Style + + +# Data - Three groups with different distributions (plant growth measurements in cm) +np.random.seed(42) +group_a = np.random.normal(25, 5, 150) # Shade-grown plants +group_b = np.random.normal(35, 7, 180) # Partial-sun plants +group_c = np.random.normal(45, 6, 120) # Full-sun plants + +# Define bin edges +bin_edges = np.linspace(5, 65, 13) # 12 bins from 5 to 65 cm + +# Compute histogram counts for each group +counts_a, _ = np.histogram(group_a, bins=bin_edges) +counts_b, _ = np.histogram(group_b, bins=bin_edges) +counts_c, _ = np.histogram(group_c, bins=bin_edges) + +# Create bin labels (center of each bin) +bin_labels = [f"{int(bin_edges[i])}-{int(bin_edges[i + 1])}" for i in range(len(bin_edges) - 1)] + +# Custom style for pyplots.ai +custom_style = Style( + background="white", + plot_background="white", + foreground="#333333", + foreground_strong="#333333", + foreground_subtle="#666666", + colors=("#306998", "#FFD43B", "#4CAF50"), # Python Blue, Yellow, Green + title_font_size=60, + label_font_size=36, + major_label_font_size=32, + legend_font_size=36, + value_font_size=28, + tooltip_font_size=28, + stroke_width=2, +) + +# Create stacked bar chart (pygal Bar with stacked data simulates stacked histogram) +chart = pygal.StackedBar( + width=4800, + height=2700, + style=custom_style, + title="histogram-stacked \u00b7 pygal \u00b7 pyplots.ai", + x_title="Plant Height (cm)", + y_title="Frequency", + show_y_guides=True, + show_x_guides=False, + legend_at_bottom=False, + legend_box_size=30, + margin=50, + spacing=10, + truncate_legend=-1, +) + +# Set x-axis labels +chart.x_labels = bin_labels + +# Add stacked data +chart.add("Shade-grown", counts_a.tolist()) +chart.add("Partial-sun", counts_b.tolist()) +chart.add("Full-sun", counts_c.tolist()) + +# Save outputs +chart.render_to_png("plot.png") +chart.render_to_file("plot.html") From c8ecb86cf13f2847a3611f79b5554516bbb49b1d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Dec 2025 10:38:59 +0000 Subject: [PATCH 2/3] chore(pygal): add metadata for histogram-stacked --- plots/histogram-stacked/metadata/pygal.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plots/histogram-stacked/metadata/pygal.yaml diff --git a/plots/histogram-stacked/metadata/pygal.yaml b/plots/histogram-stacked/metadata/pygal.yaml new file mode 100644 index 0000000000..f86340c4d5 --- /dev/null +++ b/plots/histogram-stacked/metadata/pygal.yaml @@ -0,0 +1,19 @@ +# Per-library metadata for pygal implementation of histogram-stacked +# Auto-generated by impl-generate.yml + +library: pygal +specification_id: histogram-stacked +created: '2025-12-30T10:38:59Z' +updated: '2025-12-30T10:38:59Z' +generated_by: claude-opus-4-5-20251101 +workflow_run: 20594562097 +issue: 0 +python_version: 3.13.11 +library_version: 3.1.0 +preview_url: https://storage.googleapis.com/pyplots-images/plots/histogram-stacked/pygal/plot.png +preview_thumb: https://storage.googleapis.com/pyplots-images/plots/histogram-stacked/pygal/plot_thumb.png +preview_html: https://storage.googleapis.com/pyplots-images/plots/histogram-stacked/pygal/plot.html +quality_score: null +review: + strengths: [] + weaknesses: [] From eb022dedfe64efd052c32e82cb63432e8b4eb272 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Dec 2025 10:48:54 +0000 Subject: [PATCH 3/3] chore(pygal): update quality score 91 and review feedback for histogram-stacked --- .../implementations/pygal.py | 6 +++--- plots/histogram-stacked/metadata/pygal.yaml | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/plots/histogram-stacked/implementations/pygal.py b/plots/histogram-stacked/implementations/pygal.py index d80712ea26..f130e6d018 100644 --- a/plots/histogram-stacked/implementations/pygal.py +++ b/plots/histogram-stacked/implementations/pygal.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai histogram-stacked: Stacked Histogram -Library: pygal | Python 3.13 -Quality: pending | Created: 2025-12-30 +Library: pygal 3.1.0 | Python 3.13.11 +Quality: 91/100 | Created: 2025-12-30 """ import numpy as np diff --git a/plots/histogram-stacked/metadata/pygal.yaml b/plots/histogram-stacked/metadata/pygal.yaml index f86340c4d5..b5a1b7c931 100644 --- a/plots/histogram-stacked/metadata/pygal.yaml +++ b/plots/histogram-stacked/metadata/pygal.yaml @@ -1,10 +1,7 @@ -# Per-library metadata for pygal implementation of histogram-stacked -# Auto-generated by impl-generate.yml - library: pygal specification_id: histogram-stacked created: '2025-12-30T10:38:59Z' -updated: '2025-12-30T10:38:59Z' +updated: '2025-12-30T10:48:54Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20594562097 issue: 0 @@ -13,7 +10,15 @@ library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/histogram-stacked/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/histogram-stacked/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/histogram-stacked/pygal/plot.html -quality_score: null +quality_score: 91 review: - strengths: [] - weaknesses: [] + strengths: + - Excellent implementation of stacked histogram concept using pygal StackedBar + - Clean, well-organized code following KISS principles + - Realistic plant growth scenario with meaningful group labels + - Proper title format and axis labels with units + - Good color palette with sufficient contrast between groups + - Appropriate use of custom Style for consistent theming + weaknesses: + - Legend position in top-left corner could be moved to avoid proximity to plot area + - Could leverage more pygal-specific features like custom tooltips or value labels