From abe86d4ee824e708529b3d13c683f4963173bf54 Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Tue, 19 May 2026 15:10:59 +0200 Subject: [PATCH] fix(prompts): address Copilot follow-up review on #7389 / #7391 / #7393 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Eight inline Copilot comments across the canvas-halve PRs landed after the PRs were auto-merged. All substantive, all applied: - prompts/plot-generator.md (from #7391 review): Output Files snippet still showed `dpi=300` for matplotlib + `width=1600 scale=3` for plotly — the exact stale values the PR was supposed to remove. Updated to the new 3200×1800 convention. - prompts/library/plotnine.md (from #7389 review): "Sizing" snippet uses `element_text(...)` but Import block didn't include it → generated code would `NameError`. Added `element_text`, `element_rect`, `element_line` to the import list. - prompts/library/highcharts.md (from #7389 review): "X-axis labels cut off" pitfall still recommended `'14px'`, contradicting the new 12px default. Reframed as 12px default with 14px as the specific-case bump. - prompts/default-style-guide.md (from #7389 review): Native-pixel column in the Visual Sizing Defaults table mixed `'pt'` (bokeh), px (highcharts), and unitless (pygal) under one cell. Split per-library so readers don't copy the wrong unit; added explanatory note. - prompts/library/matplotlib.md + seaborn.md (from #7389 review): `ax.legend(...)` was unconditional; on single-series plots that prints "No artists with labels found to put in legend". Wrapped in `if len(ax.get_legend_handles_labels()[0]) > 1:`. - prompts/library/bokeh.md (from #7389 review): Sizing snippet had no legend fontsize example. Added commented-out `p.legend.label_text_font_size = '12pt'` line (commented because legends only apply when add_layout/legend_label= is used). - prompts/quality-evaluator.md (from #7393 review): Example JSON arithmetic drifted when I bumped `vq01_text_legibility` from 5 → 6 in #7393 but forgot to update `visual_quality.total` (was 23, sub-scores now sum to 24) and the top-level `score` (was 76 → now 77). Fixed both. These were all reasonable suggestions that arrived after auto-merge fired. Future work: poll Copilot review explicitly before --auto-merging cosmetic / prompt PRs so the suggestions can be addressed in the same PR. Added as a note to project_impl_generate_process_gaps.md follow-up list. --- prompts/default-style-guide.md | 10 +++++----- prompts/library/bokeh.md | 4 ++++ prompts/library/highcharts.md | 2 +- prompts/library/matplotlib.md | 5 ++++- prompts/library/plotnine.md | 1 + prompts/library/seaborn.md | 3 +++ prompts/plot-generator.md | 8 ++++---- prompts/quality-evaluator.md | 4 ++-- 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/prompts/default-style-guide.md b/prompts/default-style-guide.md index 1ee29ff21d..720831ffbc 100644 --- a/prompts/default-style-guide.md +++ b/prompts/default-style-guide.md @@ -183,12 +183,12 @@ Three library families with different sizing controls: |---------|--------------------------------------------|------------------------------------------|------------------------------------------| | Canvas (16:9) | `figsize=(8, 4.5)` `dpi=400` | `width=800 height=450 scale=4` | `width=3200 height=1800` | | Canvas (1:1) | `figsize=(6, 6)` `dpi=400` | `width=600 height=600 scale=4` | `width=2400 height=2400` | -| Title | 14pt | 18px | '18pt' | -| Axis labels | 12pt | 14px | '14pt' | -| Tick labels | 10pt | 12px | '12pt' | -| Legend | 10pt | 12px | '12pt' | +| Title | 14pt | 18px | bokeh `'18pt'`; highcharts `'18px'`; pygal `18` | +| Axis labels | 12pt | 14px | bokeh `'14pt'`; highcharts `'14px'`; pygal `14` | +| Tick labels | 10pt | 12px | bokeh `'12pt'`; highcharts `'12px'`; pygal `12` | +| Legend | 10pt | 12px | bokeh `'12pt'`; highcharts `'12px'`; pygal `12` | -All three families produce the same 3200×1800 (or 2400×2400) output, so text pixel sizes are comparable across libraries. +All three families produce the same 3200×1800 (or 2400×2400) output, so text pixel sizes are comparable across libraries. The Native-pixel column uses each library's own unit convention — bokeh uses `pt` strings, highcharts uses `px` strings (because it goes through CSS in the rendered HTML), pygal uses unitless integers — see each library's prompt for the exact API. **Marker and line sizes** vary by library API and aren't directly comparable as a single number — matplotlib's `s=` is in points², plotly's `marker.size` is a pixel diameter, altair's `mark_point(size=...)` is an area, plotnine / lets-plot / ggplot2's `geom_point(size=...)` uses a smaller ggplot scale. See each library's own prompt (`prompts/library/.md` → "Sizing" section) for the canonical starting values, and adapt to data density per the heuristic below. diff --git a/prompts/library/bokeh.md b/prompts/library/bokeh.md index 5d65a6ae2f..f94169493c 100644 --- a/prompts/library/bokeh.md +++ b/prompts/library/bokeh.md @@ -96,6 +96,10 @@ p.yaxis.axis_label_text_font_size = '14pt' p.xaxis.major_label_text_font_size = '12pt' p.yaxis.major_label_text_font_size = '12pt' +# Legend text — apply only when a legend is present +# (set legend_label= on glyphs or configure p.legend after add_layout) +# p.legend.label_text_font_size = '12pt' + # Element sizes (density-aware — see default-style-guide.md) p.scatter(..., size=10) # ~2-3x default p.line(..., line_width=2.5) diff --git a/prompts/library/highcharts.md b/prompts/library/highcharts.md index 164d23513b..385999fef0 100644 --- a/prompts/library/highcharts.md +++ b/prompts/library/highcharts.md @@ -152,7 +152,7 @@ See `prompts/default-style-guide.md` "Proportional Sizing" for review criteria. 6. **X-axis labels cut off in PNG**: Category labels may be clipped at the bottom. Fix by: - Increase bottom margin: `chart.options.chart = {'marginBottom': 100, ...}` - Or add spacingBottom: `chart.options.chart = {'spacingBottom': 60, ...}` - - Ensure labels have `style: {'fontSize': '14px'}` for visibility at 3200x1800 + - Default `style: {'fontSize': '12px'}` per the new 3200×1800 sizing. If still clipped after the margin fixes, bump to `'14px'` for that specific case — but keep all other label fontsizes at 12px for cross-axis balance. ## Colors diff --git a/prompts/library/matplotlib.md b/prompts/library/matplotlib.md index 30e1bb78f8..8d44ed77fc 100644 --- a/prompts/library/matplotlib.md +++ b/prompts/library/matplotlib.md @@ -54,7 +54,10 @@ ax.set_title(title, fontsize=14, fontweight='medium') ax.set_xlabel(x_label, fontsize=12) ax.set_ylabel(y_label, fontsize=12) ax.tick_params(axis='both', labelsize=10) -ax.legend(fontsize=10) +# Legend at 10pt — skip ax.legend() for single-series plots (avoids the +# "No artists with labels found to put in legend" warning) +if len(ax.get_legend_handles_labels()[0]) > 1: + ax.legend(fontsize=10) # Element sizes ax.scatter(x, y, s=100, edgecolors='white', linewidth=0.5) # s=60-150 (density-aware) diff --git a/prompts/library/plotnine.md b/prompts/library/plotnine.md index 2a770d4f95..695cb1cce9 100644 --- a/prompts/library/plotnine.md +++ b/prompts/library/plotnine.md @@ -29,6 +29,7 @@ from plotnine import ( ggplot, aes, geom_point, geom_line, geom_bar, geom_boxplot, labs, theme, theme_minimal, + element_text, element_rect, element_line, scale_fill_brewer, scale_color_brewer ) ``` diff --git a/prompts/library/seaborn.md b/prompts/library/seaborn.md index b0c9968833..90adc1f83b 100644 --- a/prompts/library/seaborn.md +++ b/prompts/library/seaborn.md @@ -52,6 +52,9 @@ ax.set_title(title, fontsize=14, fontweight='medium') ax.set_xlabel(x_label, fontsize=12) ax.set_ylabel(y_label, fontsize=12) ax.tick_params(axis='both', labelsize=10) +# Legend at 10pt — skip for single-series plots (no labeled artists → warning) +if len(ax.get_legend_handles_labels()[0]) > 1: + ax.legend(fontsize=10) # Or use sns.set_context for global scaling sns.set_context("notebook", font_scale=1.0) diff --git a/prompts/plot-generator.md b/prompts/plot-generator.md index ca5484a5c6..3362a9e44e 100644 --- a/prompts/plot-generator.md +++ b/prompts/plot-generator.md @@ -447,11 +447,11 @@ anyplot renders at **3200 × 1800 px** (16:9) or **2400 × 2400 px** (1:1) — l ```python THEME = os.getenv("ANYPLOT_THEME", "light") # already defined at top -# matplotlib/seaborn/plotnine (static, PNG only) -plt.savefig(f'plot-{THEME}.png', dpi=300, bbox_inches='tight', facecolor=PAGE_BG) +# matplotlib/seaborn/plotnine (static, PNG only) — figsize=(8, 4.5) dpi=400 → 3200×1800 +plt.savefig(f'plot-{THEME}.png', dpi=400, bbox_inches='tight', facecolor=PAGE_BG) -# plotly (PNG + HTML) -fig.write_image(f'plot-{THEME}.png', width=1600, height=900, scale=3) +# plotly (PNG + HTML) — width=800 height=450 scale=4 → 3200×1800 +fig.write_image(f'plot-{THEME}.png', width=800, height=450, scale=4) fig.write_html(f'plot-{THEME}.html', include_plotlyjs='cdn') # bokeh (PNG + HTML) diff --git a/prompts/quality-evaluator.md b/prompts/quality-evaluator.md index a8ec117642..ecf5937d7a 100644 --- a/prompts/quality-evaluator.md +++ b/prompts/quality-evaluator.md @@ -91,12 +91,12 @@ You evaluate implementations that passed all auto-reject checks. Focus purely on ```json { - "score": 76, + "score": 77, "tier": "Good", "pass": false, "visual_quality": { - "total": 23, + "total": 24, "vq01_text_legibility": {"score": 6, "max": 8, "note": "Title slightly oversized for content — fontsize=18pt squeezes against the right edge; reduce to ~14pt"}, "vq02_no_overlap": {"score": 6, "max": 6, "note": "No overlap"}, "vq03_element_visibility": {"score": 5, "max": 6, "note": "Visible but markers could be better adapted"},