From 61b63f44be60ce2a3096774f043d37f6cafbb3e5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Dec 2025 22:47:23 +0000 Subject: [PATCH 1/3] feat(pygal): implement histogram-density --- .../implementations/pygal.py | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 plots/histogram-density/implementations/pygal.py diff --git a/plots/histogram-density/implementations/pygal.py b/plots/histogram-density/implementations/pygal.py new file mode 100644 index 0000000000..ba0da800a1 --- /dev/null +++ b/plots/histogram-density/implementations/pygal.py @@ -0,0 +1,67 @@ +"""pyplots.ai +histogram-density: Density Histogram +Library: pygal | Python 3.13 +Quality: pending | Created: 2025-12-29 +""" + +import numpy as np +import pygal +from pygal.style import Style + + +# Data - Test scores with a realistic bimodal distribution +np.random.seed(42) +# Create bimodal distribution (two groups of students) +scores_group1 = np.random.normal(loc=65, scale=10, size=150) +scores_group2 = np.random.normal(loc=82, scale=8, size=100) +scores = np.concatenate([scores_group1, scores_group2]) +scores = np.clip(scores, 0, 100) # Clip to valid score range + +# Calculate histogram bins and density values +n_bins = 25 +counts, bin_edges = np.histogram(scores, bins=n_bins, density=True) +bin_centers = (bin_edges[:-1] + bin_edges[1:]) / 2 + +# Custom style for pyplots +custom_style = Style( + background="white", + plot_background="white", + foreground="#333333", + foreground_strong="#333333", + foreground_subtle="#666666", + colors=("#306998",), # Python Blue + title_font_size=48, + label_font_size=36, + major_label_font_size=32, + legend_font_size=32, + value_font_size=28, + stroke_width=0, + opacity=0.85, +) + +# Create histogram chart +chart = pygal.Bar( + width=4800, + height=2700, + style=custom_style, + title="histogram-density · pygal · pyplots.ai", + x_title="Test Score", + y_title="Density (Probability per Unit)", + show_legend=False, + show_x_guides=False, + show_y_guides=True, + x_label_rotation=0, + margin=60, + spacing=1, + print_values=False, +) + +# Create bar labels from bin centers (show every 5th label for clarity) +chart.x_labels = [f"{int(bc)}" if i % 5 == 0 else "" for i, bc in enumerate(bin_centers)] + +# Add density histogram data +chart.add("Density", [{"value": float(c), "label": f"Score: {int(bin_centers[i])}"} for i, c in enumerate(counts)]) + +# Save outputs +chart.render_to_file("plot.html") +chart.render_to_png("plot.png") From 3a4872650c1f671bfcdf0818ef63e3dd670fcbee Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Dec 2025 22:47:43 +0000 Subject: [PATCH 2/3] chore(pygal): add metadata for histogram-density --- plots/histogram-density/metadata/pygal.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plots/histogram-density/metadata/pygal.yaml diff --git a/plots/histogram-density/metadata/pygal.yaml b/plots/histogram-density/metadata/pygal.yaml new file mode 100644 index 0000000000..9169b558bc --- /dev/null +++ b/plots/histogram-density/metadata/pygal.yaml @@ -0,0 +1,19 @@ +# Per-library metadata for pygal implementation of histogram-density +# Auto-generated by impl-generate.yml + +library: pygal +specification_id: histogram-density +created: '2025-12-29T22:47:43Z' +updated: '2025-12-29T22:47:43Z' +generated_by: claude-opus-4-5-20251101 +workflow_run: 20584330628 +issue: 0 +python_version: 3.13.11 +library_version: 3.1.0 +preview_url: https://storage.googleapis.com/pyplots-images/plots/histogram-density/pygal/plot.png +preview_thumb: https://storage.googleapis.com/pyplots-images/plots/histogram-density/pygal/plot_thumb.png +preview_html: https://storage.googleapis.com/pyplots-images/plots/histogram-density/pygal/plot.html +quality_score: null +review: + strengths: [] + weaknesses: [] From 737fb2ff9e5d18ac63e4af9e3ac37ef8f63c7386 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Dec 2025 22:54:24 +0000 Subject: [PATCH 3/3] chore(pygal): update quality score 91 and review feedback for histogram-density --- .../implementations/pygal.py | 6 ++--- plots/histogram-density/metadata/pygal.yaml | 22 +++++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/plots/histogram-density/implementations/pygal.py b/plots/histogram-density/implementations/pygal.py index ba0da800a1..d72869b36e 100644 --- a/plots/histogram-density/implementations/pygal.py +++ b/plots/histogram-density/implementations/pygal.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai histogram-density: Density Histogram -Library: pygal | Python 3.13 -Quality: pending | Created: 2025-12-29 +Library: pygal 3.1.0 | Python 3.13.11 +Quality: 91/100 | Created: 2025-12-29 """ import numpy as np diff --git a/plots/histogram-density/metadata/pygal.yaml b/plots/histogram-density/metadata/pygal.yaml index 9169b558bc..27aa5d9441 100644 --- a/plots/histogram-density/metadata/pygal.yaml +++ b/plots/histogram-density/metadata/pygal.yaml @@ -1,10 +1,7 @@ -# Per-library metadata for pygal implementation of histogram-density -# Auto-generated by impl-generate.yml - library: pygal specification_id: histogram-density created: '2025-12-29T22:47:43Z' -updated: '2025-12-29T22:47:43Z' +updated: '2025-12-29T22:54:23Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20584330628 issue: 0 @@ -13,7 +10,18 @@ library_version: 3.1.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/histogram-density/pygal/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/histogram-density/pygal/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/histogram-density/pygal/plot.html -quality_score: null +quality_score: 91 review: - strengths: [] - weaknesses: [] + strengths: + - Excellent bimodal distribution data that clearly demonstrates density histogram + concept + - Clean, readable code following KISS principles with proper random seed + - Well-formatted title following the required convention + - Good use of pygal Style class for comprehensive customization + - Appropriate axis labels with descriptive units + - Smart x-label spacing (every 5th label) prevents overlap + weaknesses: + - Spec suggests adding a reference line or theoretical PDF overlay for context, + which is not implemented + - Could use pygal native Histogram chart type instead of Bar chart for more semantic + correctness