name: paper-figure-generation description: Produce publication-grade figures for scientific papers — reproducible matplotlib/seaborn data figures and original TikZ method/framework/architecture figures, held to a four-axis quality bar (depth · elegance · unimpeachable · visible-gap) and exported as editable PDF+PNG+SVG with a runnable critique gate. Use this whenever a figure is destined for a paper, journal, conference submission, thesis, or report — making a plot/chart publication- or journal-ready, building a method/architecture/framework diagram or 技术路线图 (the hero figure a paper opens with), a schematic or workflow figure, or cleaning up a matplotlib/seaborn/TikZ figure that currently looks like a homework plot. Trigger even when the user never says "publication": if the figure goes into a written scientific document, this skill applies.
Paper Figure Generation
Turn a dataset + a claim into a publication-grade figure — one a top-journal editor accepts with no revision request. Default stack: matplotlib/seaborn for data figures, original TikZ for hero/method figures, both reproducible (script + data file), exported as PDF + PNG + SVG.
First read
Open references/figure-cookbook.md and work in this order:
- §0b (the quality bar) — the four axes (Depth · Elegance · Unimpeachable · Visible gap). Internalize this before plotting; it is the acceptance test, not an afterthought.
- §0a (Figure Contract) — write the one-line
core_claim+ hero panel + what stats go on the figure, before any code. - §0 style preset —
from _style import paper_style, save(the preset lives inscripts/_style.py). Never hand-edit rcParams per figure. - §A archetypes A1–A13 — pick the matching template (time series+CI, sorted bar, grouped bar, residual, heatmap, scatter+fit, Pareto, tornado, confusion, phase, network), paste, swap the data path + labels, run.
For a hero / method / framework figure (the one that carries the paper)
Read references/framework-figures.md — the deep-dive, with five compilable heroes to
paste from (P1 pipeline, P2 paradigm-swimlanes, + T4 graphical-model / data-tensor / matrix-fit),
the borrowable TikZ techniques, and curated journal-grade resources.
The rule to internalize first: never a generic boxes-and-arrows flowchart — embed the real
method object (a distribution, a before/after scatter, a decision region), not a text label.
Route through the cookbook: §I composition paradigms P1–P6 → §J craft spec → §K
original standalone TikZ (compiled to PDF, \includegraphics, zero compile risk). framework-figures.md
walks all three with worked examples.
Hard rules (non-negotiable)
- Reproducible only: every figure is generated by a committed script that reads data from a file path. No inline data > 20 rows. No AI-generated images (unreproducible).
- Three-format vector:
save()writes PDF + PNG + SVG (text stays editable in SVG/PDF). Never ship a 72-dpi PNG. - Style preset, once: call
paper_style(...)at the top; do not tweak rcParams per script. - Colorblind + grayscale safe: use the palette + redundant marker/linestyle so every series survives a B&W print and deuteranopia.
- Units + N + uncertainty on the figure: axis labels carry units; N annotated; CI band / error bars shown (§0b axis 3).
- Acceptance test (run it, don't eyeball it): before declaring done, run the gate
python scripts/critique.py scripts/figN_<name>.py— it enforces the §F checklist + §G anti-patterns mechanically (must report no FAIL) and prints the four judgment prompts. Then answer the four §0b axes by hand usingreferences/figure-critique.md(the mechanical floor is defense; the four judgment ticks are the offense). A figure that merely "plots correctly" — or merely passes the script — is not done.
Optional front-ends / references
- §M Origin — allowed only behind the M1–M6 guardrails (same-source CSV, journal .otp template, vector three-format, reproducible matplotlib fallback for key figures). Hero figures never go through Origin.
- §L external template library — if
<TEMPLATE_LIB>is set inCLAUDE.md, use it as a design reference (imitate composition/palette/chart-type, redraw original); never paste foreign output into the paper.
Captions
After the figure passes the critique gate (references/figure-critique.md), write the caption with references/caption-and-quality.md — the caption states the conclusion, not "Figure shows X"; reference figures in text as "as in Fig. 3", never "the figure below".
Output locations
- scripts →
scripts/figN_<short-name>.py(or.texfor TikZ) - figures →
outputs/figures/figN_<short-name>.{pdf,png,svg} - register each in
outputs/figures/figure_manifest.csv(id, path, claim, source data, generation script).