From 9de1089cb78f314ca6877620c6e7017ee49425c8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Jun 2026 01:54:10 +0000 Subject: [PATCH 1/5] feat(plotnine): implement acf-pacf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regen from quality 90. Addressed: - Canvas: fixed figure_size=(16,10)/dpi=300 → (8,4.5)/dpi=400 for canonical 3200×1800 - Theme: added ANYPLOT_THEME support with full theme-adaptive chrome (PAGE_BG, INK, INK_SOFT, INK_MUTED) - Colors: replaced custom hexes (Python Blue/muted silver/red) with Imprint palette (BRAND=#009E73 for significant, ALARM=#AE3030 for CI bounds, INK_MUTED for non-significant) - Y-axis label: removed shared "Correlation" label; ACF/PACF strip headers now serve as per-panel identifiers per spec - Title: fixed to include language token — "acf-pacf · python · plotnine · anyplot.ai" - Output: fixed save to f"plot-{THEME}.png" with dpi=400 - Added sys.path workaround for script/library name conflict - Reduced y-axis expansion from default 5% to 4% to reduce PACF empty space Co-Authored-By: Claude Sonnet 4.6 --- .../implementations/python/plotnine.py | 88 ++++++++++++------- 1 file changed, 58 insertions(+), 30 deletions(-) diff --git a/plots/acf-pacf/implementations/python/plotnine.py b/plots/acf-pacf/implementations/python/plotnine.py index b9f21ef5ab..4dd6a76f4b 100644 --- a/plots/acf-pacf/implementations/python/plotnine.py +++ b/plots/acf-pacf/implementations/python/plotnine.py @@ -1,12 +1,26 @@ -""" pyplots.ai +"""anyplot.ai acf-pacf: Autocorrelation and Partial Autocorrelation (ACF/PACF) Plot -Library: plotnine 0.15.3 | Python 3.14.3 -Quality: 90/100 | Created: 2026-03-14 +Library: plotnine | Python 3.13 +Quality: pending | Created: 2026-06-10 """ +import os +import sys + import numpy as np import pandas as pd -from plotnine import ( + + +# Work around naming conflict with plotnine.py script and plotnine package +script_dir = os.path.dirname(os.path.abspath(__file__)) +if script_dir in sys.path: + sys.path.remove(script_dir) +if "" in sys.path: + sys.path.remove("") +if "." in sys.path: + sys.path.remove(".") + +from plotnine import ( # noqa: E402 aes, element_blank, element_line, @@ -21,13 +35,26 @@ labs, scale_color_manual, scale_x_continuous, + scale_y_continuous, theme, theme_minimal, ) from statsmodels.tsa.stattools import acf, pacf -# Data - Simulated monthly temperature with seasonality and AR(1) component +# Theme tokens — Imprint palette, theme-adaptive chrome +THEME = os.getenv("ANYPLOT_THEME", "light") +PAGE_BG = "#FAF8F1" if THEME == "light" else "#1A1A17" +ELEVATED_BG = "#FFFDF6" if THEME == "light" else "#242420" +INK = "#1A1A17" if THEME == "light" else "#F0EFE8" +INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0" +INK_MUTED = "#6B6A63" if THEME == "light" else "#A8A79F" + +# Imprint palette positions used +BRAND = "#009E73" # position 1 — significant lags (brand green, first series) +ALARM = "#AE3030" # position 5 — confidence bounds (semantic: alert/threshold) + +# Data — simulated monthly temperature with seasonality and AR(1) component np.random.seed(42) n_obs = 240 time = np.arange(n_obs) @@ -51,43 +78,44 @@ # Mark significance: lags outside confidence bounds df["significant"] = np.where(np.abs(df["correlation"]) > confidence_bound, "Significant", "Non-significant") -# Lag 0 in ACF is always 1.0 by definition - not a meaningful significant lag +# Lag 0 in ACF is always 1.0 by definition — not a meaningful significant lag df.loc[(df["panel"] == "ACF") & (df["lag"] == 0), "significant"] = "Non-significant" -# Colors -PYTHON_BLUE = "#306998" -MUTED_SILVER = "#B0BEC5" -CONF_RED = "#C0392B" +# Title — 41 chars, within 67-char baseline, no font scaling needed +title = "acf-pacf · python · plotnine · anyplot.ai" -# Plot with significance coloring for visual storytelling +# Plot — strip labels "ACF" / "PACF" serve as per-panel y-axis identifiers per spec plot = ( ggplot(df, aes(x="lag", y="correlation", color="significant")) - + geom_hline(yintercept=0, color="#9E9E9E", size=0.7) - + geom_hline(yintercept=confidence_bound, linetype="dashed", color=CONF_RED, size=0.8, alpha=0.5) - + geom_hline(yintercept=-confidence_bound, linetype="dashed", color=CONF_RED, size=0.8, alpha=0.5) - + geom_segment(aes(x="lag", xend="lag", y=0, yend="correlation"), size=1.3) - + geom_point(size=3.2) - + scale_color_manual(values={"Significant": PYTHON_BLUE, "Non-significant": MUTED_SILVER}) + + geom_hline(yintercept=0, color=INK_SOFT, size=0.6, alpha=0.8) + + geom_hline(yintercept=confidence_bound, linetype="dashed", color=ALARM, size=0.7, alpha=0.65) + + geom_hline(yintercept=-confidence_bound, linetype="dashed", color=ALARM, size=0.7, alpha=0.65) + + geom_segment(aes(x="lag", xend="lag", y=0, yend="correlation"), size=1.2) + + geom_point(size=3.0) + + scale_color_manual(values={"Significant": BRAND, "Non-significant": INK_MUTED}) + guides(color="none") + facet_wrap("~panel", ncol=1, scales="free_y") - + scale_x_continuous(breaks=range(0, n_lags + 1, 6)) - + labs(x="Lag", y="Correlation", title="acf-pacf · plotnine · pyplots.ai") + + scale_x_continuous(breaks=list(range(0, n_lags + 1, 6))) + + scale_y_continuous(expand=(0.04, 0)) + + labs(x="Lag", y="", title=title) + theme_minimal() + theme( - figure_size=(16, 10), - text=element_text(size=14, color="#2C3E50"), - axis_title=element_text(size=20, face="bold"), - axis_text=element_text(size=16, color="#546E7A"), - plot_title=element_text(size=24, face="bold", color="#1A237E"), - strip_text=element_text(size=20, face="bold", color="#263238"), - strip_background=element_rect(fill="#F5F5F5", color="none"), + figure_size=(8, 4.5), + plot_background=element_rect(fill=PAGE_BG, color=PAGE_BG), + panel_background=element_rect(fill=PAGE_BG), panel_grid_major_x=element_blank(), panel_grid_minor_x=element_blank(), - panel_grid_major_y=element_line(color="#ECEFF1", size=0.4), + panel_grid_major_y=element_line(color=INK, size=0.2, alpha=0.12), panel_grid_minor_y=element_blank(), - panel_spacing_y=0.15, + axis_title_x=element_text(color=INK, size=10), + axis_title_y=element_blank(), + axis_text=element_text(color=INK_SOFT, size=8), + plot_title=element_text(color=INK, size=12), + strip_background=element_rect(fill=ELEVATED_BG, color="none"), + strip_text=element_text(color=INK, size=10, face="bold"), + panel_spacing_y=0.2, ) ) -# Save -plot.save("plot.png", dpi=300, verbose=False) +# Save — canvas: 8×4.5 in × 400 dpi = 3200×1800 px +plot.save(f"plot-{THEME}.png", dpi=400, width=8, height=4.5, units="in", verbose=False) From ceb69af4aba9c276bce747c954d8d582690ff167 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Jun 2026 01:54:23 +0000 Subject: [PATCH 2/5] chore(plotnine): add metadata for acf-pacf --- plots/acf-pacf/metadata/python/plotnine.yaml | 242 ++----------------- 1 file changed, 16 insertions(+), 226 deletions(-) diff --git a/plots/acf-pacf/metadata/python/plotnine.yaml b/plots/acf-pacf/metadata/python/plotnine.yaml index 15e38d9acb..67f2e0e051 100644 --- a/plots/acf-pacf/metadata/python/plotnine.yaml +++ b/plots/acf-pacf/metadata/python/plotnine.yaml @@ -1,231 +1,21 @@ +# Per-library metadata for plotnine implementation of acf-pacf +# Auto-generated by impl-generate.yml + library: plotnine +language: python specification_id: acf-pacf created: '2026-03-14T22:18:48Z' -updated: '2026-03-14T22:36:36Z' -generated_by: claude-opus-4-5-20251101 -workflow_run: 23097477539 +updated: '2026-06-10T01:54:22Z' +generated_by: claude-sonnet +workflow_run: 27247342539 issue: 4663 -python_version: 3.14.3 -library_version: 0.15.3 -preview_url: https://storage.googleapis.com/anyplot-images/plots/acf-pacf/plotnine/plot.png -preview_html: null -quality_score: 90 +language_version: 3.13.13 +library_version: 0.15.5 +preview_url_light: https://storage.googleapis.com/anyplot-images/plots/acf-pacf/python/plotnine/plot-light.png +preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/acf-pacf/python/plotnine/plot-dark.png +preview_html_light: null +preview_html_dark: null +quality_score: null review: - strengths: - - Significance coloring (blue vs silver) creates meaningful visual hierarchy beyond - typical ACF/PACF plots - - Data choice with clear seasonality (period 12) perfectly demonstrates the primary - use case - - Idiomatic plotnine grammar of graphics with facet_wrap for panel layout - - Thorough theme customization with explicit font sizes, subtle grid, and styled - strip backgrounds - - Lag 0 correctly shown as non-significant despite being 1.0 by definition - weaknesses: - - Y-axis labeled Correlation instead of individual ACF/PACF labels as spec requests - - PACF panel has proportionally more empty space due to smaller correlation range - with free_y - image_description: The plot displays two vertically stacked panels — ACF (top) and - PACF (bottom) — on a clean minimal background. Stem lines extend from a gray zero - baseline to correlation values, capped with circular markers. Significant lags - (outside confidence bounds) are colored in Python Blue (#306998), while non-significant - lags appear in muted silver (#B0BEC5). Red dashed lines at approximately ±0.13 - mark the 95% confidence bounds. The ACF panel shows a clear sinusoidal seasonal - pattern with period 12, with correlations oscillating between approximately -0.7 - and +1.0. Lag 0 in ACF is shown as a gray (non-significant) dot at 1.0. The PACF - panel starts from lag 1, showing a strong spike at lag 1 (~0.7), a sharp negative - spike at lag 3 (~-0.7), and seasonal spikes around lags 5-6 and 9-12, with most - higher lags falling within the confidence bounds. The title "acf-pacf · plotnine - · pyplots.ai" appears at the top in dark indigo bold text. Strip labels "ACF" - and "PACF" sit in light gray backgrounds. X-axis labeled "Lag" with ticks at intervals - of 6, shared y-axis labeled "Correlation". Overall layout is 16:10 landscape with - generous whitespace and subtle horizontal grid lines. - criteria_checklist: - visual_quality: - score: 28 - max: 30 - items: - - id: VQ-01 - name: Text Legibility - score: 8 - max: 8 - passed: true - comment: 'All font sizes explicitly set: title=24pt, axis_title=20pt, axis_text=16pt, - strip_text=20pt' - - id: VQ-02 - name: No Overlap - score: 6 - max: 6 - passed: true - comment: No overlapping elements; x-axis ticks spaced at intervals of 6 - - id: VQ-03 - name: Element Visibility - score: 6 - max: 6 - passed: true - comment: Stem lines (size=1.3) and points (size=3.2) clearly visible; significance - coloring aids discrimination - - id: VQ-04 - name: Color Accessibility - score: 4 - max: 4 - passed: true - comment: Blue vs silver is colorblind-safe; red confidence bounds have adequate - contrast - - id: VQ-05 - name: Layout & Canvas - score: 3 - max: 4 - passed: false - comment: Good proportions but PACF panel has more empty vertical space due - to free_y scaling - - id: VQ-06 - name: Axis Labels & Title - score: 1 - max: 2 - passed: false - comment: Descriptive labels but spec requests ACF/PACF as individual y-axis - labels - design_excellence: - score: 15 - max: 20 - items: - - id: DE-01 - name: Aesthetic Sophistication - score: 6 - max: 8 - passed: true - comment: Custom palette with significance coloring, intentional hierarchy, - good typography - - id: DE-02 - name: Visual Refinement - score: 5 - max: 6 - passed: true - comment: X-grid removed, subtle y-grid, styled strip backgrounds, generous - whitespace - - id: DE-03 - name: Data Storytelling - score: 4 - max: 6 - passed: true - comment: Significance coloring creates visual hierarchy; seasonal pattern - is visually compelling - spec_compliance: - score: 14 - max: 15 - items: - - id: SC-01 - name: Plot Type - score: 5 - max: 5 - passed: true - comment: Correct ACF/PACF stem plots in two vertically stacked subplots - - id: SC-02 - name: Required Features - score: 3 - max: 4 - passed: false - comment: All major features present; y-axis labeled Correlation rather than - ACF/PACF per spec - - id: SC-03 - name: Data Mapping - score: 3 - max: 3 - passed: true - comment: X=lag number, Y=correlation value, all data visible - - id: SC-04 - name: Title & Legend - score: 3 - max: 3 - passed: true - comment: Title format correct; legend appropriately hidden - data_quality: - score: 15 - max: 15 - items: - - id: DQ-01 - name: Feature Coverage - score: 6 - max: 6 - passed: true - comment: Shows seasonal pattern, AR(1) component, positive/negative correlations, - significant/non-significant lags - - id: DQ-02 - name: Realistic Context - score: 5 - max: 5 - passed: true - comment: Monthly temperature with seasonality — realistic, neutral, demonstrates - primary use case - - id: DQ-03 - name: Appropriate Scale - score: 4 - max: 4 - passed: true - comment: 240 observations, 36 lags, correlations in valid [-1,1] range - code_quality: - score: 10 - max: 10 - items: - - id: CQ-01 - name: KISS Structure - score: 3 - max: 3 - passed: true - comment: 'Linear flow: imports, data, compute, DataFrame, plot, save' - - id: CQ-02 - name: Reproducibility - score: 2 - max: 2 - passed: true - comment: np.random.seed(42) set - - id: CQ-03 - name: Clean Imports - score: 2 - max: 2 - passed: true - comment: All imports used, no extras - - id: CQ-04 - name: Code Elegance - score: 2 - max: 2 - passed: true - comment: Clean, appropriate complexity; pd.Categorical for panel ordering - is elegant - - id: CQ-05 - name: Output & API - score: 1 - max: 1 - passed: true - comment: Saves as plot.png at dpi=300, current API - library_mastery: - score: 8 - max: 10 - items: - - id: LM-01 - name: Idiomatic Usage - score: 5 - max: 5 - passed: true - comment: 'Expertly uses grammar of graphics: ggplot + aes + geom layers + - facet_wrap + scale + theme' - - id: LM-02 - name: Distinctive Features - score: 3 - max: 5 - passed: true - comment: facet_wrap with free_y, pd.Categorical for ordered facets, significance - mapping via aes - verdict: APPROVED -impl_tags: - dependencies: - - statsmodels - techniques: - - faceting - - layer-composition - patterns: - - data-generation - dataprep: - - time-series - styling: - - grid-styling + strengths: [] + weaknesses: [] From 258272cc468e91040f728a6ef0ee310c1e50f4e3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Jun 2026 02:01:29 +0000 Subject: [PATCH 3/5] chore(plotnine): update quality score 89 and review feedback for acf-pacf --- .../implementations/python/plotnine.py | 6 +- plots/acf-pacf/metadata/python/plotnine.yaml | 266 +++++++++++++++++- 2 files changed, 262 insertions(+), 10 deletions(-) diff --git a/plots/acf-pacf/implementations/python/plotnine.py b/plots/acf-pacf/implementations/python/plotnine.py index 4dd6a76f4b..4a2c05e46c 100644 --- a/plots/acf-pacf/implementations/python/plotnine.py +++ b/plots/acf-pacf/implementations/python/plotnine.py @@ -1,7 +1,7 @@ -"""anyplot.ai +""" anyplot.ai acf-pacf: Autocorrelation and Partial Autocorrelation (ACF/PACF) Plot -Library: plotnine | Python 3.13 -Quality: pending | Created: 2026-06-10 +Library: plotnine 0.15.5 | Python 3.13.13 +Quality: 89/100 | Updated: 2026-06-10 """ import os diff --git a/plots/acf-pacf/metadata/python/plotnine.yaml b/plots/acf-pacf/metadata/python/plotnine.yaml index 67f2e0e051..4e0701ca89 100644 --- a/plots/acf-pacf/metadata/python/plotnine.yaml +++ b/plots/acf-pacf/metadata/python/plotnine.yaml @@ -1,11 +1,8 @@ -# Per-library metadata for plotnine implementation of acf-pacf -# Auto-generated by impl-generate.yml - library: plotnine language: python specification_id: acf-pacf created: '2026-03-14T22:18:48Z' -updated: '2026-06-10T01:54:22Z' +updated: '2026-06-10T02:01:29Z' generated_by: claude-sonnet workflow_run: 27247342539 issue: 4663 @@ -15,7 +12,262 @@ preview_url_light: https://storage.googleapis.com/anyplot-images/plots/acf-pacf/ preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/acf-pacf/python/plotnine/plot-dark.png preview_html_light: null preview_html_dark: null -quality_score: null +quality_score: 89 review: - strengths: [] - weaknesses: [] + strengths: + - Perfect Visual Quality — all font sizes explicitly set, no overlap, good element + visibility in both themes + - 'Semantic color encoding: brand green (#009E73) for significant lags, muted gray + for non-significant — creates instant visual hierarchy' + - Correct Imprint palette with full theme-adaptive chrome (title, ticks, grid, strip + labels) in both light and dark renders + - 'All spec-required features present: ACF top / PACF bottom, stem lines, 95% CI + dashed bounds, lag 0 in ACF, PACF from lag 1, 36 lags' + - Clean idiomatic plotnine grammar — facet_wrap with ordered categorical panel, + layer composition (geom_segment + geom_point + geom_hline), guides suppression + - Realistic monthly temperature data with clear seasonality (period-12 spikes in + ACF) and AR(1) structure (decaying early PACF) + - 'Semantic use of #AE3030 for confidence bounds — appropriate alert/threshold role + for matte red anchor' + weaknesses: + - 'DE-01: Aesthetic sophistication sits at ''well-configured default'' level — title + uses weight=''regular'' and could be bold, no deliberate typographic hierarchy + between title vs strip vs tick labels beyond size differences; add plot_title=element_text(face=''bold'') + and consider a stronger weight for strip labels' + - 'DE-02: Visual refinement is good but not complete — panel_background matches + plot_background which is correct, but the strip_background=ELEVATED_BG makes a + subtle but unpolished contrast; consider making strip_background=PAGE_BG with + a bottom border line for cleaner separation, and tighten panel_spacing_y from + 0.2 to ~0.1 to reduce gap between panels' + - 'DE-03: The significance coloring creates hierarchy but the storytelling could + be more intentional — the period-12 seasonal pattern in ACF (major spikes at lags + 12, 24, 36) is the key feature of this data; a subtle annotation or different + emphasis on those lags would strengthen the narrative' + image_description: |- + Light render (plot-light.png): + Background: Warm off-white #FAF8F1 — correct anyplot light surface, no pure white. + Chrome: Title "acf-pacf · python · plotnine · anyplot.ai" at top in dark ink — readable. Strip labels "ACF" and "PACF" in bold dark ink — readable. X-axis label "Lag" in dark ink — readable. Tick labels (0, 6, 12…36 on x; values on y) in INK_SOFT gray — readable. + Data: ACF panel (top) shows lollipop stems from zero baseline; significant lags in brand green #009E73, non-significant in muted gray. Lag 0 rendered gray (by design — always 1.0, excluded from significance). Dashed red (#AE3030) confidence bounds at ±0.127. Strong periodic spikes at lags ~6, 12, 18, 24, 30, 36 reflecting seasonal period-12 and period-6 components. PACF panel (bottom) shows early significant green spikes (lags 1, 5, 6, 7) reflecting AR structure, remaining lags mostly gray within bounds. + Legibility verdict: PASS — all text clearly readable against the warm off-white background. + + Dark render (plot-dark.png): + Background: Warm near-black #1A1A17 — correct anyplot dark surface, no pure black. + Chrome: Title in light #F0EFE8 — readable against dark background. Strip labels "ACF" / "PACF" in bold light ink — readable. X-axis label "Lag" in light ink — readable. Tick labels in #B8B7B0 secondary ink — readable. No dark-on-dark failures detected. + Data: Data colors identical to light render — significant lags in brand green #009E73, non-significant in adaptive muted gray. Dashed confidence bounds in #AE3030. The contrast between green lags and the dark background is strong and clear. + Legibility verdict: PASS — all text clearly readable against the warm near-black background. No dark-on-dark issues. Data colors unchanged from light render. + criteria_checklist: + visual_quality: + score: 30 + max: 30 + items: + - id: VQ-01 + name: Text Legibility + score: 8 + max: 8 + passed: true + comment: All font sizes explicitly set (title=12, axis_title_x=10, axis_text=8, + strip_text=10). Readable in both themes at full resolution and mobile width. + - id: VQ-02 + name: No Overlap + score: 6 + max: 6 + passed: true + comment: No overlapping elements — stems, points, labels, and confidence lines + all clearly separated. + - id: VQ-03 + name: Element Visibility + score: 6 + max: 6 + passed: true + comment: Segments size=1.2, points size=3.0 — well-adapted to 37-lag density. + Significant vs non-significant clearly distinguishable. + - id: VQ-04 + name: Color Accessibility + score: 2 + max: 2 + passed: true + comment: Green (#009E73) vs muted gray — good luminance contrast, CVD-safe. + Red confidence bounds add redundant threshold signal. + - id: VQ-05 + name: Layout & Canvas + score: 4 + max: 4 + passed: true + comment: Two-panel layout fills 3200x1800 canvas proportionally. Panels balanced, + margins appropriate. + - id: VQ-06 + name: Axis Labels & Title + score: 2 + max: 2 + passed: true + comment: X-axis 'Lag' descriptive. Y-axes labeled via strip labels 'ACF' and + 'PACF' — effective for this faceted layout. Title correct format. + - id: VQ-07 + name: Palette Compliance + score: 2 + max: 2 + passed: true + comment: 'Significant lags in #009E73 (first/only series). Non-significant + in theme-adaptive muted (INK_MUTED). Confidence bounds in #AE3030 semantic + red. Backgrounds #FAF8F1/#1A1A17 correct. Chrome adaptive in both themes.' + design_excellence: + score: 12 + max: 20 + items: + - id: DE-01 + name: Aesthetic Sophistication + score: 4 + max: 8 + passed: false + comment: 'Well-configured above defaults — semantic color encoding for significance + is thoughtful. But lacks publication-ready polish: title is regular weight + (not bold), typographic hierarchy between title/strip/tick could be stronger, + no deliberate whitespace distribution.' + - id: DE-02 + name: Visual Refinement + score: 4 + max: 6 + passed: false + comment: 'Good refinement: Y-only grid at 12% alpha, no x-grid, elevated strip + backgrounds, zero baseline hline. panel_spacing_y=0.2 creates some gap between + panels. Not fully polished — strip background creates subtle contrast against + panel background.' + - id: DE-03 + name: Data Storytelling + score: 4 + max: 6 + passed: false + comment: Good visual hierarchy through significance coloring. The seasonal + period-12 pattern in ACF and AR(1) structure in PACF are clearly visible. + More intentional emphasis on key structural features would improve the narrative. + spec_compliance: + score: 15 + max: 15 + items: + - id: SC-01 + name: Plot Type + score: 5 + max: 5 + passed: true + comment: Correct ACF/PACF stem/lollipop plots in stacked subplots. Both panels + present. + - id: SC-02 + name: Required Features + score: 4 + max: 4 + passed: true + comment: 'All features: ACF top, PACF bottom, shared x-axis, vertical stem + lines, 95% CI dashed bounds, lag 0 in ACF, PACF from lag 1, x=''Lag'', y=''ACF''/''PACF'' + (strip labels), 36 lags.' + - id: SC-03 + name: Data Mapping + score: 3 + max: 3 + passed: true + comment: X=lag (0-36), Y=correlation value. Both panels show full range. + - id: SC-04 + name: Title & Legend + score: 3 + max: 3 + passed: true + comment: Title 'acf-pacf · python · plotnine · anyplot.ai' — correct format. + Legend suppressed via guides(color='none') — appropriate since strip labels + serve as identifiers. + data_quality: + score: 15 + max: 15 + items: + - id: DQ-01 + name: Feature Coverage + score: 6 + max: 6 + passed: true + comment: 'Shows all aspects: strong significant lags (green), non-significant + lags (gray), lag 0=1.0, seasonal periodic spikes at 6/12/18/24/30/36, AR(1) + structure in PACF.' + - id: DQ-02 + name: Realistic Context + score: 5 + max: 5 + passed: true + comment: Monthly temperature with seasonal and AR(1) components — realistic + climate time series, neutral domain, real-world plausible structure. + - id: DQ-03 + name: Appropriate Scale + score: 4 + max: 4 + passed: true + comment: ACF and PACF values in [-1, 1] range. Seasonal amplitude, AR coefficient, + and noise levels are realistic for temperature data. + code_quality: + score: 10 + max: 10 + items: + - id: CQ-01 + name: KISS Structure + score: 3 + max: 3 + passed: true + comment: 'Flat structure: imports → data → compute → dataframe → plot → save. + sys.path manipulation is justified by naming conflict (script named plotnine.py).' + - id: CQ-02 + name: Reproducibility + score: 2 + max: 2 + passed: true + comment: np.random.seed(42) set before data generation. + - id: CQ-03 + name: Clean Imports + score: 2 + max: 2 + passed: true + comment: All imports used. sys/os needed for path workaround. + - id: CQ-04 + name: Code Elegance + score: 2 + max: 2 + passed: true + comment: Clean, appropriate complexity. No fake functionality. Significance + classification is clean. + - id: CQ-05 + name: Output & API + score: 1 + max: 1 + passed: true + comment: Saves as plot-{THEME}.png with dpi=400, width=8, height=4.5 — correct + canvas. + library_mastery: + score: 7 + max: 10 + items: + - id: LM-01 + name: Idiomatic Usage + score: 4 + max: 5 + passed: true + comment: 'Very idiomatic plotnine grammar: facet_wrap with ordered categorical, + layer composition (geom_hline + geom_segment + geom_point), scale_color_manual, + guides(color=''none''), scale_x_continuous with breaks.' + - id: LM-02 + name: Distinctive Features + score: 3 + max: 5 + passed: true + comment: Uses plotnine's grammar-of-graphics faceting with ordered pd.Categorical + for panel ordering — distinctive to ggplot-style libraries. Layer composition + approach for lollipop stems is idiomatic ggplot2 pattern. + verdict: REJECTED +impl_tags: + dependencies: + - statsmodels + techniques: + - faceting + - layer-composition + - manual-ticks + patterns: + - data-generation + dataprep: + - time-series + styling: + - grid-styling + - alpha-blending From 29b5744d9f8b7251b6ea85e7720e79124212716f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Jun 2026 02:06:45 +0000 Subject: [PATCH 4/5] fix(plotnine): address review feedback for acf-pacf Attempt 1/3 - fixes based on AI review --- .../implementations/python/plotnine.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/plots/acf-pacf/implementations/python/plotnine.py b/plots/acf-pacf/implementations/python/plotnine.py index 4a2c05e46c..f458061baf 100644 --- a/plots/acf-pacf/implementations/python/plotnine.py +++ b/plots/acf-pacf/implementations/python/plotnine.py @@ -1,4 +1,4 @@ -""" anyplot.ai +"""anyplot.ai acf-pacf: Autocorrelation and Partial Autocorrelation (ACF/PACF) Plot Library: plotnine 0.15.5 | Python 3.13.13 Quality: 89/100 | Updated: 2026-06-10 @@ -30,6 +30,7 @@ geom_hline, geom_point, geom_segment, + geom_vline, ggplot, guides, labs, @@ -81,6 +82,14 @@ # Lag 0 in ACF is always 1.0 by definition — not a meaningful significant lag df.loc[(df["panel"] == "ACF") & (df["lag"] == 0), "significant"] = "Non-significant" +# Seasonal lag markers restricted to ACF panel — period-12 structure at lags 12, 24, 36 +seasonal_ann_df = pd.DataFrame( + { + "xintercept": [12, 24, 36], + "panel": pd.Categorical(["ACF", "ACF", "ACF"], categories=["ACF", "PACF"], ordered=True), + } +) + # Title — 41 chars, within 67-char baseline, no font scaling needed title = "acf-pacf · python · plotnine · anyplot.ai" @@ -88,6 +97,9 @@ plot = ( ggplot(df, aes(x="lag", y="correlation", color="significant")) + geom_hline(yintercept=0, color=INK_SOFT, size=0.6, alpha=0.8) + + geom_vline( + data=seasonal_ann_df, mapping=aes(xintercept="xintercept"), color=BRAND, alpha=0.14, size=0.8, linetype="dotted" + ) + geom_hline(yintercept=confidence_bound, linetype="dashed", color=ALARM, size=0.7, alpha=0.65) + geom_hline(yintercept=-confidence_bound, linetype="dashed", color=ALARM, size=0.7, alpha=0.65) + geom_segment(aes(x="lag", xend="lag", y=0, yend="correlation"), size=1.2) @@ -110,10 +122,10 @@ axis_title_x=element_text(color=INK, size=10), axis_title_y=element_blank(), axis_text=element_text(color=INK_SOFT, size=8), - plot_title=element_text(color=INK, size=12), - strip_background=element_rect(fill=ELEVATED_BG, color="none"), + plot_title=element_text(color=INK, size=12, face="bold"), + strip_background=element_rect(fill=PAGE_BG, color="none"), strip_text=element_text(color=INK, size=10, face="bold"), - panel_spacing_y=0.2, + panel_spacing_y=0.08, ) ) From bd361a2ca22bd14faf977893179875bde22db263 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 10 Jun 2026 02:12:27 +0000 Subject: [PATCH 5/5] chore(plotnine): update quality score 91 and review feedback for acf-pacf --- .../implementations/python/plotnine.py | 4 +- plots/acf-pacf/metadata/python/plotnine.yaml | 185 ++++++++---------- 2 files changed, 84 insertions(+), 105 deletions(-) diff --git a/plots/acf-pacf/implementations/python/plotnine.py b/plots/acf-pacf/implementations/python/plotnine.py index f458061baf..ccaea9ce90 100644 --- a/plots/acf-pacf/implementations/python/plotnine.py +++ b/plots/acf-pacf/implementations/python/plotnine.py @@ -1,7 +1,7 @@ -"""anyplot.ai +""" anyplot.ai acf-pacf: Autocorrelation and Partial Autocorrelation (ACF/PACF) Plot Library: plotnine 0.15.5 | Python 3.13.13 -Quality: 89/100 | Updated: 2026-06-10 +Quality: 91/100 | Updated: 2026-06-10 """ import os diff --git a/plots/acf-pacf/metadata/python/plotnine.yaml b/plots/acf-pacf/metadata/python/plotnine.yaml index 4e0701ca89..147b420084 100644 --- a/plots/acf-pacf/metadata/python/plotnine.yaml +++ b/plots/acf-pacf/metadata/python/plotnine.yaml @@ -2,7 +2,7 @@ library: plotnine language: python specification_id: acf-pacf created: '2026-03-14T22:18:48Z' -updated: '2026-06-10T02:01:29Z' +updated: '2026-06-10T02:12:27Z' generated_by: claude-sonnet workflow_run: 27247342539 issue: 4663 @@ -12,49 +12,40 @@ preview_url_light: https://storage.googleapis.com/anyplot-images/plots/acf-pacf/ preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/acf-pacf/python/plotnine/plot-dark.png preview_html_light: null preview_html_dark: null -quality_score: 89 +quality_score: 91 review: strengths: - - Perfect Visual Quality — all font sizes explicitly set, no overlap, good element - visibility in both themes - - 'Semantic color encoding: brand green (#009E73) for significant lags, muted gray - for non-significant — creates instant visual hierarchy' - - Correct Imprint palette with full theme-adaptive chrome (title, ticks, grid, strip - labels) in both light and dark renders - - 'All spec-required features present: ACF top / PACF bottom, stem lines, 95% CI - dashed bounds, lag 0 in ACF, PACF from lag 1, 36 lags' - - Clean idiomatic plotnine grammar — facet_wrap with ordered categorical panel, - layer composition (geom_segment + geom_point + geom_hline), guides suppression - - Realistic monthly temperature data with clear seasonality (period-12 spikes in - ACF) and AR(1) structure (decaying early PACF) - - 'Semantic use of #AE3030 for confidence bounds — appropriate alert/threshold role - for matte red anchor' + - Full visual quality with all font sizes explicitly set and both themes rendering + cleanly — no dark-on-dark failures + - Semantic color coding distinguishes significant from non-significant lags immediately, + creating a clear visual hierarchy without a legend + - Seasonal period markers (vertical dotted lines at lags 12, 24, 36) enrich the + ACF panel with interpretive context beyond what the spec requires + - 'Perfect spec compliance: lag 0 in ACF only, PACF from lag 1, 95% CI dashed lines, + 36 lags, shared x-axis via faceting' + - 'Idiomatic plotnine usage: facet_wrap with free_y scales, pd.Categorical for panel + ordering, panel-specific geom_vline with data= parameter' weaknesses: - - 'DE-01: Aesthetic sophistication sits at ''well-configured default'' level — title - uses weight=''regular'' and could be bold, no deliberate typographic hierarchy - between title vs strip vs tick labels beyond size differences; add plot_title=element_text(face=''bold'') - and consider a stronger weight for strip labels' - - 'DE-02: Visual refinement is good but not complete — panel_background matches - plot_background which is correct, but the strip_background=ELEVATED_BG makes a - subtle but unpolished contrast; consider making strip_background=PAGE_BG with - a bottom border line for cleaner separation, and tighten panel_spacing_y from - 0.2 to ~0.1 to reduce gap between panels' - - 'DE-03: The significance coloring creates hierarchy but the storytelling could - be more intentional — the period-12 seasonal pattern in ACF (major spikes at lags - 12, 24, 36) is the key feature of this data; a subtle annotation or different - emphasis on those lags would strengthen the narrative' + - 'DE-01 ceiling at 5/8: the design is intentional and above defaults but lacks + the visual polish that would push it to strong design — e.g., no custom typography + weight hierarchy beyond bold strip labels, no subtle annotation note about what + the seasonal markers represent' + - 'LM-02 at 3/5: the panel-specific geom_vline technique is distinctive, but the + overall approach remains close to what ggplot2 would produce; more plotnine-idiomatic + fine-tuning (e.g., explicit theme element_line for axis spines) could differentiate + it further' image_description: |- Light render (plot-light.png): - Background: Warm off-white #FAF8F1 — correct anyplot light surface, no pure white. - Chrome: Title "acf-pacf · python · plotnine · anyplot.ai" at top in dark ink — readable. Strip labels "ACF" and "PACF" in bold dark ink — readable. X-axis label "Lag" in dark ink — readable. Tick labels (0, 6, 12…36 on x; values on y) in INK_SOFT gray — readable. - Data: ACF panel (top) shows lollipop stems from zero baseline; significant lags in brand green #009E73, non-significant in muted gray. Lag 0 rendered gray (by design — always 1.0, excluded from significance). Dashed red (#AE3030) confidence bounds at ±0.127. Strong periodic spikes at lags ~6, 12, 18, 24, 30, 36 reflecting seasonal period-12 and period-6 components. PACF panel (bottom) shows early significant green spikes (lags 1, 5, 6, 7) reflecting AR structure, remaining lags mostly gray within bounds. - Legibility verdict: PASS — all text clearly readable against the warm off-white background. + Background: Warm off-white #FAF8F1 — not pure white, correct Imprint surface + Chrome: Title "acf-pacf · python · plotnine · anyplot.ai" in dark #1A1A17 bold at ~55% width; strip labels "ACF" / "PACF" bold and clear; axis tick labels in #4A4A44 (INK_SOFT); x-axis "Lag" label clearly readable — all dark text on light surface + Data: Significant lags in #009E73 brand green; non-significant in muted gray; confidence bounds as red (#AE3030) dashed horizontal lines; subtle dotted green verticals at lags 12/24/36 in ACF panel; lag 0 correctly at 1.0 and colored gray + Legibility verdict: PASS Dark render (plot-dark.png): - Background: Warm near-black #1A1A17 — correct anyplot dark surface, no pure black. - Chrome: Title in light #F0EFE8 — readable against dark background. Strip labels "ACF" / "PACF" in bold light ink — readable. X-axis label "Lag" in light ink — readable. Tick labels in #B8B7B0 secondary ink — readable. No dark-on-dark failures detected. - Data: Data colors identical to light render — significant lags in brand green #009E73, non-significant in adaptive muted gray. Dashed confidence bounds in #AE3030. The contrast between green lags and the dark background is strong and clear. - Legibility verdict: PASS — all text clearly readable against the warm near-black background. No dark-on-dark issues. Data colors unchanged from light render. + Background: Warm near-black #1A1A17 — not pure black, correct Imprint surface + Chrome: Title and strip labels in light cream #F0EFE8; tick labels and axis labels in light gray #B8B7B0 — all light text on dark surface; no dark-on-dark failures detected + Data: Colors identical to light render — #009E73 for significant lags, muted gray for non-significant, #AE3030 dashed confidence bounds; seasonal markers at same alpha; visually indistinguishable from light render in terms of data encoding + Legibility verdict: PASS criteria_checklist: visual_quality: score: 30 @@ -65,81 +56,74 @@ review: score: 8 max: 8 passed: true - comment: All font sizes explicitly set (title=12, axis_title_x=10, axis_text=8, - strip_text=10). Readable in both themes at full resolution and mobile width. + comment: All font sizes explicitly set (title=12, axis_title_x=10, strip_text=10, + axis_text=8); well-proportioned in both themes - id: VQ-02 name: No Overlap score: 6 max: 6 passed: true - comment: No overlapping elements — stems, points, labels, and confidence lines - all clearly separated. + comment: No overlapping text or data elements in either render - id: VQ-03 name: Element Visibility score: 6 max: 6 passed: true - comment: Segments size=1.2, points size=3.0 — well-adapted to 37-lag density. - Significant vs non-significant clearly distinguishable. + comment: Lollipop stems (size=1.2) and points (size=3.0) well-adapted to 36-lag + density - id: VQ-04 name: Color Accessibility score: 2 max: 2 passed: true - comment: Green (#009E73) vs muted gray — good luminance contrast, CVD-safe. - Red confidence bounds add redundant threshold signal. + comment: Green vs muted gray with adequate luminance separation; CVD-safe + via Imprint palette - id: VQ-05 name: Layout & Canvas score: 4 max: 4 passed: true - comment: Two-panel layout fills 3200x1800 canvas proportionally. Panels balanced, - margins appropriate. + comment: Two-panel layout fills 3200x1800 canvas well; balanced margins; no + clipping - id: VQ-06 name: Axis Labels & Title score: 2 max: 2 passed: true - comment: X-axis 'Lag' descriptive. Y-axes labeled via strip labels 'ACF' and - 'PACF' — effective for this faceted layout. Title correct format. + comment: X-axis Lag present; ACF/PACF strip labels per spec convention; correct + title format - id: VQ-07 name: Palette Compliance score: 2 max: 2 passed: true - comment: 'Significant lags in #009E73 (first/only series). Non-significant - in theme-adaptive muted (INK_MUTED). Confidence bounds in #AE3030 semantic - red. Backgrounds #FAF8F1/#1A1A17 correct. Chrome adaptive in both themes.' + comment: 'Significant lags #009E73; semantic red #AE3030 for CI bounds; backgrounds + #FAF8F1/#1A1A17 correct; all chrome theme-adaptive' design_excellence: - score: 12 + score: 13 max: 20 items: - id: DE-01 name: Aesthetic Sophistication - score: 4 + score: 5 max: 8 - passed: false - comment: 'Well-configured above defaults — semantic color encoding for significance - is thoughtful. But lacks publication-ready polish: title is regular weight - (not bold), typographic hierarchy between title/strip/tick could be stronger, - no deliberate whitespace distribution.' + passed: true + comment: 'Above defaults: intentional semantic color coding, semantic red + for thresholds, seasonal period markers — deliberate design thinking' - id: DE-02 name: Visual Refinement score: 4 max: 6 - passed: false - comment: 'Good refinement: Y-only grid at 12% alpha, no x-grid, elevated strip - backgrounds, zero baseline hline. panel_spacing_y=0.2 creates some gap between - panels. Not fully polished — strip background creates subtle contrast against - panel background.' + passed: true + comment: X-axis grid removed, Y-axis grid subtle (size=0.2 alpha=0.12), strip + background matches panel, tight panel spacing, legend hidden - id: DE-03 name: Data Storytelling score: 4 max: 6 - passed: false - comment: Good visual hierarchy through significance coloring. The seasonal - period-12 pattern in ACF and AR(1) structure in PACF are clearly visible. - More intentional emphasis on key structural features would improve the narrative. + passed: true + comment: 'Clear narrative: seasonal autocorrelation at lags 12/24/36 and AR(1) + in PACF; significance coloring creates immediate visual hierarchy' spec_compliance: score: 15 max: 15 @@ -149,30 +133,29 @@ review: score: 5 max: 5 passed: true - comment: Correct ACF/PACF stem/lollipop plots in stacked subplots. Both panels - present. + comment: Correct ACF+PACF stem/lollipop in two vertically stacked subplots + with shared x-axis - id: SC-02 name: Required Features score: 4 max: 4 passed: true - comment: 'All features: ACF top, PACF bottom, shared x-axis, vertical stem - lines, 95% CI dashed bounds, lag 0 in ACF, PACF from lag 1, x=''Lag'', y=''ACF''/''PACF'' - (strip labels), 36 lags.' + comment: Vertical stems from zero; 95% CI dashed lines; lag 0 in ACF only; + PACF from lag 1; 36 lags - id: SC-03 name: Data Mapping score: 3 max: 3 passed: true - comment: X=lag (0-36), Y=correlation value. Both panels show full range. + comment: X=lag number, Y=correlation; all lags visible; shared x-axis via + facet_wrap - id: SC-04 name: Title & Legend score: 3 max: 3 passed: true - comment: Title 'acf-pacf · python · plotnine · anyplot.ai' — correct format. - Legend suppressed via guides(color='none') — appropriate since strip labels - serve as identifiers. + comment: Title 'acf-pacf · python · plotnine · anyplot.ai' correct; legend + hidden (appropriate for diagnostic plot) data_quality: score: 15 max: 15 @@ -182,23 +165,22 @@ review: score: 6 max: 6 passed: true - comment: 'Shows all aspects: strong significant lags (green), non-significant - lags (gray), lag 0=1.0, seasonal periodic spikes at 6/12/18/24/30/36, AR(1) - structure in PACF.' + comment: Demonstrates lag-0 anchor, seasonal spikes at multiples of 12, AR(1) + decay in PACF, mix of significant/non-significant lags - id: DQ-02 name: Realistic Context score: 5 max: 5 passed: true - comment: Monthly temperature with seasonal and AR(1) components — realistic - climate time series, neutral domain, real-world plausible structure. + comment: Monthly temperature time series with annual seasonality and AR(1) + — realistic, neutral, 240 observations (20 years) - id: DQ-03 name: Appropriate Scale score: 4 max: 4 passed: true - comment: ACF and PACF values in [-1, 1] range. Seasonal amplitude, AR coefficient, - and noise levels are realistic for temperature data. + comment: Correlations bounded [-1,1]; CI at ±1.96/sqrt(240) physically correct; + period-12 seasonal structure realistic for monthly climate code_quality: score: 10 max: 10 @@ -208,66 +190,63 @@ review: score: 3 max: 3 passed: true - comment: 'Flat structure: imports → data → compute → dataframe → plot → save. - sys.path manipulation is justified by naming conflict (script named plotnine.py).' + comment: 'Linear flow: imports→tokens→data→ACF/PACF→DataFrame→plot→save; no + functions/classes' - id: CQ-02 name: Reproducibility score: 2 max: 2 passed: true - comment: np.random.seed(42) set before data generation. + comment: np.random.seed(42) set before all stochastic operations - id: CQ-03 name: Clean Imports score: 2 max: 2 passed: true - comment: All imports used. sys/os needed for path workaround. + comment: All imported names used; statsmodels acf/pacf used; os/sys used for + path workaround - id: CQ-04 name: Code Elegance score: 2 max: 2 passed: true - comment: Clean, appropriate complexity. No fake functionality. Significance - classification is clean. + comment: Clean Pythonic code; sys.path workaround documented; no fake UI - id: CQ-05 name: Output & API score: 1 max: 1 passed: true - comment: Saves as plot-{THEME}.png with dpi=400, width=8, height=4.5 — correct - canvas. + comment: Saves as plot-{THEME}.png with correct dpi/width/height parameters library_mastery: - score: 7 + score: 8 max: 10 items: - id: LM-01 name: Idiomatic Usage - score: 4 + score: 5 max: 5 passed: true - comment: 'Very idiomatic plotnine grammar: facet_wrap with ordered categorical, - layer composition (geom_hline + geom_segment + geom_point), scale_color_manual, - guides(color=''none''), scale_x_continuous with breaks.' + comment: Expertly uses facet_wrap with scales=free_y, pd.Categorical for panel + ordering, data= parameter in geom_vline, guides(color=none) - id: LM-02 name: Distinctive Features score: 3 max: 5 passed: true - comment: Uses plotnine's grammar-of-graphics faceting with ordered pd.Categorical - for panel ordering — distinctive to ggplot-style libraries. Layer composition - approach for lollipop stems is idiomatic ggplot2 pattern. - verdict: REJECTED + comment: Free-scale faceting, ordered pd.Categorical, panel-specific data + injection via geom_vline(data=) — moderately distinctive but approach transfers + to ggplot2 + verdict: APPROVED impl_tags: dependencies: - statsmodels techniques: - faceting - layer-composition - - manual-ticks patterns: - data-generation dataprep: - time-series styling: - - grid-styling - alpha-blending + - grid-styling