feat(prompts): include language in plot title format (closes #6958)#7141
Merged
Conversation
Rendered plot titles change from `{spec-id} · {library} · anyplot.ai` to
`{spec-id} · {Language} · {library} · anyplot.ai` so viewers can tell
Python from R at a glance — necessary now that R/ggplot2 implementations
sit alongside the Python libraries (and because plotnine is the Python
port of ggplot, the library name alone is ambiguous).
Updated all four prompts that pin the canonical format: the generator
spec + Python script example, plus the SC-04 title-format check in the
quality-evaluator, quality-criteria, and ai-quality-review prompts so
review doesn't flag the new pattern. Existing R impls keep their old
titles; only generations after this merge use the new format.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the prompt-defined plot title convention to include the implementation language, reducing ambiguity now that both Python and R implementations exist (notably around ggplot2 vs. plotnine).
Changes:
- Update
prompts/plot-generator.mdto require plot titles in the format{spec-id} · {Language} · {library} · anyplot.ai(plus examples). - Update SC-04 “Title & Legend” checks in the quality evaluator/criteria prompts to reflect the new
{Language}token. - Update the AI quality review workflow prompt to check the new title format.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| prompts/workflow-prompts/ai-quality-review.md | Updates SC-04 title format check to include {Language}. |
| prompts/quality-evaluator.md | Updates SC-04 rubric text to include {Language} in the expected title format. |
| prompts/quality-criteria.md | Updates SC-04 scoring criteria to reference {Language} in the title format. |
| prompts/plot-generator.md | Changes the canonical title format (and examples) to include {Language}. |
| | SC-02 | Required Features | 4 | All spec features present? | | ||
| | SC-03 | Data Mapping | 3 | X/Y correctly assigned? All data visible? | | ||
| | SC-04 | Title & Legend | 3 | `{spec-id} · {library} · anyplot.ai`? Legend labels correct? | | ||
| | SC-04 | Title & Legend | 3 | `{spec-id} · {Language} · {library} · anyplot.ai` (Language ∈ {Python, R})? Legend labels correct? | |
| | SC-02 | Required Features | 4 | All features from spec? | | ||
| | SC-03 | Data Mapping | 3 | X/Y correct? Axes show all data? | | ||
| | SC-04 | Title & Legend | 3 | `{spec-id} · {library} · anyplot.ai`? Legend labels match? | | ||
| | SC-04 | Title & Legend | 3 | `{spec-id} · {Language} · {library} · anyplot.ai` (Language ∈ {Python, R})? Legend labels match? | |
| | Points | Criterion | | ||
| |--------|-----------| | ||
| | 3 | Title format `{spec-id} · {library} · anyplot.ai` AND legend labels correct | | ||
| | 3 | Title format `{spec-id} · {Language} · {library} · anyplot.ai` (Language ∈ {Python, R}) AND legend labels correct | |
| ``` | ||
|
|
||
| `{Language}` is the implementation's language, capitalized: `Python` or `R`. The language token is **required** — viewers cannot tell from `ggplot2` alone whether a chart is Python or R (`plotnine` is the Python ggplot port), and going forward every rendered title must surface the runtime language. | ||
|
|
5 tasks
Copilot review on #7141 flagged two issues: 1. SC-04 hard-coded `{spec-id} · {Language} · {library} · anyplot.ai` as the only acceptable form, but plot-generator.md still permits an optional `{Descriptive Title} · ` prefix. Without aligning the review-side rubric, valid prefixed titles would lose points. Updated the SC-04 cell in quality-evaluator.md, quality-criteria.md, and ai-quality-review.md to explicitly accept both shapes. 2. prompts/library/ggplot2.md's labs() example showed a generic `title = "Basic Scatter"` placeholder, which could steer ggplot2 generations away from the canonical title format. Updated the example to the new form so the skeleton is self-consistent with the Title Format MANDATORY block. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MarkusNeusinger
added a commit
that referenced
this pull request
May 17, 2026
… carousel (#7142) ## Summary Makes language (Python / R) a first-class concept across the site, now that R/ggplot2 implementations sit next to the Python libraries. The data layer already supports it; the UI didn't. Companion to #7141 (image-title change for issue #6958). - **Plot cards** — normal mode shows `spec-id · {Language} · {library}`; compact mode encodes language as a file-extension suffix on the abbreviation (`mpl.py`, `ggplot2.r`) to stay two tokens wide. - **Library cards** — small uppercase chip (`[PYTHON]` / `[R]`) next to the library name. Stale "nine Python plotting libraries" meta-copy also fixed. - **SpecPage** — `<title>` + og:title + breadcrumb JSON-LD surface language. Detail mode also gets a small muted `Python · matplotlib` row near the report-issue link. - **`lang` filter** — new spec-level FilterCategory; FilterBar picks it up via the existing data-driven dispatch. Backend `/plots/filter` accepts `?lang=python` (or `r`) and returns `lang` in counts/globalCounts. - **Carousel scope** — the impl-detail carousel now walks **all** impls of the spec by default, flipping the URL's language path segment as it cycles. The user can pin a scope via `?language=python`, in which case the carousel stays language-locked **and** the query param is preserved across prev/next. PlotsPage card-click propagates `?language=…` when an active `lang` filter is in effect, so clicking through from filtered plots preserves the scope. This is also what makes a future `python.anyplot.ai`-style subdomain expressible as URL state. ## Files touched - `app/src/constants/index.ts` — new `LANG_DISPLAY`, `LANG_EXT` helpers (mirror the existing `LIB_TO_LANG` pattern). - `app/src/types/index.ts` — `lang` added to `FilterCategory`, `FILTER_LABELS`, `FILTER_TOOLTIPS`, `FILTER_CATEGORIES`. - `app/src/components/ImageCard.tsx`, `LibraryCard.tsx`, `LibraryPills.tsx` — display + props. - `app/src/pages/LibrariesPage.tsx`, `PlotsPage.tsx`, `SpecPage.tsx` — title, breadcrumb, carousel scope, filter-preserving navigation. - `api/routers/plots.py` — `_get_category_values` + friends grow a `language` parameter; threaded through every call site. - `tests/unit/api/test_plots_helpers.py`, `test_routers.py` — signature updates + new `lang` cases. ## Test plan - [x] `cd app && yarn type-check` clean - [x] `cd app && yarn build` succeeds - [x] `cd app && yarn test --run` — 459 / 459 pass - [x] `uv run pytest tests/unit/api/` — 511 / 511 pass (including new `lang` filter cases) - [ ] **Visual walkthrough deferred** — no local DB to bring up the full stack. Please eyeball on the deploy preview: - `/plots` cards (normal + compact) - `/libraries` chips - `/biplot-pca` title (unfiltered) - `/biplot-pca?language=python` title + grid + carousel - `/biplot-pca/r/ggplot2` — carousel cycles cross-language; pressing → flips both URL path segments - `/biplot-pca/python/altair?language=python` — carousel locked to Python; `?language=` preserved across prev/next - Click a card on `/plots?lang=python` — lands on `/{spec}/python/{lib}?language=python` - Click a card on `/plots` (unfiltered) — lands on `/{spec}/{lang}/{lib}` (no query) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MarkusNeusinger
pushed a commit
that referenced
this pull request
May 18, 2026
Mirror the frontend change: rendered image titles now use
`{spec-id} · {language} · {library} · anyplot.ai` with `python`/`r`
lowercase to match the lowercase `{spec-id}` and `{library}` tokens.
Updates the canonical title definition, all examples in plot-generator.md,
the R example in library/ggplot2.md, and the SC-04 rubric line in
quality-criteria.md / quality-evaluator.md / ai-quality-review.md so
generation and review stay in sync.
Existing plot files generated since PR #7141 still carry the capitalized
form; they'll be normalised the next time daily-regen.yml picks them up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{spec-id} · {library} · anyplot.aito{spec-id} · {Language} · {library} · anyplot.ai(Language ∈ {Python, R}).Files touched
prompts/plot-generator.md— canonical format spec, the Python script example title (ax.set_title('scatter-basic · Python · matplotlib · anyplot.ai', …)), and all four example tables.prompts/quality-evaluator.md,prompts/quality-criteria.md,prompts/workflow-prompts/ai-quality-review.md— the SC-04 title-format check now lists{Language}so review won't flag the new pattern.No code in
core/,api/, orapp/is touched. The frontend / filter / carousel changes called for in the same conversation will land in a follow-up PR.Test plan
bulk-generate.ymlon one spec across one Python library (e.g.matplotlib) andggplot2, and visually confirm both rendered PNGs include the new language token in the image title.quality-evaluatorSC-04 passes on the new format (impl-review CI log).🤖 Generated with Claude Code