Figures¶
The figures plugin composes publication-quality figures at exact journal dimensions (Nature, Science, PNAS, Cell, and others) and QAs them before they go anywhere near a submission.
The figure pipeline¶
A figure moves through five steps, each with its own mechanical defense against the most common failure at that step, and a boomerang from validation straight back to building when a font fails:
- Plan: journal, size, panel grid, and the bible.
figure-biblescaffolds and validates onefigures/theme.jsonper project (palette, typography, text limits, Codex model settings) that every other skill and the QA scripts read - Build:
plot-stylingfor data plots,svg-figure/svg-primitivesfor schematics,transparent-iconsfor icons, orai-full-figurefor single panels and whole multi-panel figures rendered by gpt-image-2 through the Codex CLI, with large verbatim titles and panel letters - Compose:
svgutilsplaces panels at exact mm coordinates, with text preserved as inspectable<text>elements - Validate:
validate_fonts.pyreports the effective point size against the journal minimum - Export: Inkscape when available on
$PATH,cairosvgfallback otherwise
When the validator fails, the fix is mechanical: rescale the panel up, increase the source point size, or widen the canvas, not a redesign.
The plugin map¶
The plugin is a composer at the center, four element-builder skills that feed it, and a QA agent that runs on every figure regardless of how it was built:
How figure-qa decides what to check¶
figure-qa dispatches on input type, runs the matching deterministic check script, then always adds a VLM aesthetic pass on top:
- SVG →
check_svg.py(bbox / arrow-tip-to-target / point size / palette against the theme) - Raster (PNG/JPG/TIFF) →
check_raster.py(DPI / alpha channel / palette against the theme / OCR of the expected strings with their measured point size) - Plot script →
check_plot_script.py(savefigkwargs / rcParams) - Composed-figure directory → all of the above, per panel
Programmatic checks own anything with ground truth (font minima, palette compliance, geometry, rendered text); the VLM judgment pass is reserved for "does this look balanced": hierarchy, alignment, palette coherence, journal fit.
Every report ends with a JSON verdict (status, findings[].action, hint) that generation skills branch on.
The generate, QA, fix loop¶
AI-generated figures follow a bounded loop defined in figure-qa/references/iterate-loop.md: generate N candidates in parallel, QA all of them in one parallel dispatch of Sonnet-tier reviewers, rank by status and findings, apply exactly one targeted change (a Codex edit, a regenerated prompt, or moving a string to the overlay), re-QA, and stop at ship or after three iterations.
Text placement follows a ladder: the model renders panel letters, titles, and short labels at large size; dense labels go to the SVG overlay; numerals, axes, and equations go to the plot or vector skills.
Skills¶
- figure-bible: step zero; scaffolds and validates
figures/theme.json, the single palette and model-settings source for every other skill and for QA - scientific-figure: the composer (the sink):
svgutils-based, exact mm coordinates,validate_fonts.pybefore export, Inkscape/cairosvg backend - plot-styling: data plots via matplotlib, seaborn, plotnine, plotly, or PyVista, with SciencePlots recipes for Nature/IEEE/Science/Cell/PNAS/APS
- svg-figure / svg-primitives: hand-authored or programmatic schematics: boxes, arrows, and labels in SVG, with
svg-primitivespreferred for new work (mm-precise, auto-fit text, tangent-correct arrows, in-process validation) - transparent-icons: flat scientific icons through the shared Codex or API backend, or explicit Atlas Cloud, keeping the model's native alpha
- ai-full-figure: single panels or whole multi-panel figures rendered by gpt-image-2 (Codex CLI, default
gpt-5.6-lunaat max effort) with verbatim text, panels generated in parallel with reference-image consistency and composed at journal width, plus the SVG overlay for dense labels - figure-qa: the QA agent described above, run against every figure regardless of how it was built
Try it¶
"Set up a figure bible for my Nature paper"
"Generate a two-panel AI figure: EEG headset and a foundation model, with titles"
"Create a Nature 2-column figure with 3 panels showing EEG spectrograms"
"QA this figure for Science submission requirements"
"Generate a transparent icon of a neuron for my poster"
Learn more¶
The Agentic Research Course week 8, "Scientific Figures," covers this plugin hands-on.