/figures:plot-stylingfrom figures
Guides choosing between matplotlib, seaborn, plotnine, plotly, and PyVista for publication-quality figures. Applies journal-style defaults (SciencePlots) and produces SVG output for scientific figure composition.
Ships in figures. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Choose the right Python plotting library for the chart type, then apply journal-quality defaults so the panel that comes out of savefig is ready for the figures:scientific-figure composer — no manual cleanup, no font-size firefighting, no chart junk.
references/library-decision-tree.md).references/sciplots-recipes.md).Run those choices through the export conventions below and the output SVG should pass figure-qa's plot-script branch and feed scientific-figure without scale-down surprises.
| Chart type | Library | Why |
|---|---|---|
| Line / scatter / bar with custom layout | matplotlib | Most control; the lingua franca. Pair with SciencePlots styles to fix defaults. |
| Statistical (box, violin, regression, faceted) | seaborn | Better defaults than matplotlib; less code for the common cases. Built on top of matplotlib so the SciencePlots style still applies. |
| Grammar-of-graphics / R-style faceting | plotnine | Same geom_* API as ggplot2 without the rpy2 bridge. |
| Interactive HTML supplement (deck / dashboard) | plotly | Use plotly for the interactive companion; ship a matplotlib version for print. |
| 3D / volumetric / mesh | PyVista (when interactive matters) or matplotlib 3d (for static print) | matplotlib 3d is acceptable for simple panels; PyVista when the figure is the interaction. |
| Already in matplotlib, output looks ugly | stay matplotlib + SciencePlots | plt.style.use(['science', 'nature']) fixes 80% of "ugly defaults" complaints without rewriting. |
Full decision tree with concrete code snippets per branch: references/library-decision-tree.md.
The cleanest path is to install SciencePlots and apply its style sheet at the top of every plot script. The relevant style names:
science — base style (sans-serif, no chart junk, tight margins)nature — Nature column dimensions and font sizingieee — IEEE narrow-column with grayscale-safe palettevibrant / bright / high-contrast — colorblind-safe palettes from Paul Tolnotebook — slightly larger fonts for screen reading (avoid for paper)import matplotlib.pyplot as plt
import scienceplots # noqa: F401 (registers the styles)
plt.style.use(["science", "nature", "no-latex"])
no-latex is non-optional unless you have system LaTeX installed AND want path-rendered text (in which case validate_fonts.py cannot inspect font sizes — see the "no-latex" note in references/sciplots-recipes.md).
For a Nature panel at 1-column width with three lines:
import numpy as np
import matplotlib.pyplot as plt
import scienceplots # noqa: F401
plt.style.use(["science", "nature", "no-latex"])
fig, ax = plt.subplots(figsize=(3.5, 2.5)) # 89 mm x ~63 mm
t = np.linspace(0, 1, 200)
for k, label in enumerate(("control", "drug A", "drug B")):
ax.plot(t, np.sin(2 * np.pi * (k + 1) * t), label=label, linewidth=1.0)
ax.set_xlabel("time (s)")
ax.set_ylabel("amplitude (a.u.)")
ax.legend(frameon=False, loc="upper right")
fig.savefig("panel_a.svg", bbox_inches="tight", transparent=True)
That single style declaration sets sans-serif fonts at journal-appropriate sizes (Nature 5–7 pt range), removes the right and top spines, applies tight margin defaults, and picks a colorblind-safe palette. See references/sciplots-recipes.md for IEEE, Science, and APS variants.
Every plot panel that will be composed by figures:scientific-figure should:
savefig("panel.svg", ...). SVG preserves text as <text> so validate_fonts.py can inspect every label.transparent=True. The composer expects panels with transparent backgrounds so they composite cleanly onto the figure canvas. figure-qa's plot-script branch flags transparent=False and missing-transparent as issues.bbox_inches='tight'. Trim whitespace at save time so the panel's bounding box matches its visual extent. The composer's add_panel(..., scale=...) math assumes this.svg.fonttype = 'path', font validation breaks because there are no <text> elements to inspect.figsize=(3.5, ...) produces a panel that the composer can place at scale 1.0 with no font-size shrinkage.The figure-qa plot-script branch (check_plot_script.py) checks all of these statically from the script's AST. It reports savefig_not_transparent, savefig_missing_bbox_inches, and any rcparam_font_sizes below the journal minimum. See examples/sciplots_panel.py for a script that passes the QA branch cleanly.
Common matplotlib output failures and the SciencePlots-style fix:
| Failure | Cause | Fix |
|---|---|---|
| Axis labels are 12pt sans-serif by default — fine on screen, oversized for a Nature panel | matplotlib default font.size is 10 in the source, scaled to 12 at SVG export | Apply plt.style.use(['science', 'nature']) which sets 7 pt body |
| Top and right spines visible | matplotlib default | SciencePlots removes them; or manually ax.spines[['top','right']].set_visible(False) |
| Legend has a heavy black frame | matplotlib default | ax.legend(frameon=False) |
| Tick marks point inward when you wanted outward | SciencePlots science style sets xtick.direction = 'in' (matplotlib's bare default is 'out') | Intentional in the SciencePlots style; override only if your journal requires outward ticks: plt.rcParams['xtick.direction'] = 'out' |
| Color cycle uses default tableau colors (not colorblind-safe) | matplotlib default | SciencePlots' bright palette (Paul Tol), or ['#0072B2', '#D55E00', '#009E73', '#CC79A7'] (Okabe-Ito) |
| Tick labels render at different sizes than axis labels | matplotlib defaults differ across rcparams | SciencePlots harmonizes; or set xtick.labelsize / ytick.labelsize explicitly |
| Saved PNG is at 100 DPI | matplotlib default | savefig(..., dpi=300) for raster output; prefer SVG for print |
| Math text uses Computer Modern by default | matplotlib default text.usetex=False, mathtext.fontset='dejavusans' | plt.style.use(['science']) sets serif math via mathtext; or text.usetex=True if you have a LaTeX install |
After authoring a plot script, invoke figures:figure-qa through the host's skill-invocation mechanism (its programmatic branch is the command below):
SCRIPTS_DIR="${CLAUDE_PLUGIN_ROOT}/agents/figure-qa-scripts"
[ -d "$SCRIPTS_DIR" ] || SCRIPTS_DIR="$(find . -type d -name figure-qa-scripts -path '*/figures/agents/*' | head -1)"
uv run python "$SCRIPTS_DIR/check_plot_script.py" panel.py --journal nature
The plot-script branch detects the libraries used, reports rcParams font sizes (numeric and dynamic), inspects every savefig call, and offers a library-switch recommendation when the chart type would benefit. After running the script for real and producing the SVG, the raster/SVG branches verify the output too.
references/library-decision-tree.md — full decision tree with concrete snippets per branch (statistical, grammar-of-graphics, interactive, 3D, R-bridge)references/sciplots-recipes.md — Nature, IEEE, Science, APS style recipes; per-journal font and color setupreferences/element-plots.md — original matplotlib / seaborn / plotly / ggplot2 element guide ported from the legacy pluginexamples/matplotlib-element.py — canonical matplotlib panelexamples/sciplots_panel.py — SciencePlots-styled panel passing figure-qa's plot-script branchWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub neuromechanist/research-skills --plugin figures8 skills in this plugin
/ai-full-figureUse this skill when the user asks to "generate an AI figure", "make an AI-generated figure", "make a poster figure", "make a presentation figure", "generate a figure with AI", "generate figure panels with Codex", "make a multi-panel AI figure", "AI background for a figure", or wants a pictorial figure or panel (brain scene, apparatus, anatomy, pipeline illustration) rendered by gpt-image-2 through the Codex CLI with large verbatim titles and panel letters, then QA'd and iterated until it passes. Expects a theme from figures:figure-bible. Data plots, axes, numerals, and equations go to figures:plot-styling or figures:svg-primitives instead./figure-bibleUse this skill when the user asks to "make a figure bible", "set up a style bible", "create a figure theme", "make a theme for my figures", "set up a figure style", "palette for my paper figures", or wants a consistent figure style. Scaffolds and validates figures/theme.json; run before any figures skill generates images./figure-qaUse this skill to QA a scientific figure for journal compliance, alignment, palette correctness, and text legibility. Triggers on "QA this figure", "check this figure", "review my figure", "is this figure paper-ready", "validate figure", "check the text in this figure", or when invoked after a figures skill produces output (unless the caller passes no-qa). Dispatches on input type (SVG, raster PNG/JPG/TIFF, Python plot script, or composed-figure directory), runs the programmatic checks including OCR of expected strings and palette compliance against the project theme, adds a vision rubric pass, and returns a report with a machine-readable JSON verdict that drives the generate, QA, fix loop./scientific-figureThis skill should be used when the user asks to "create a figure", "make a scientific figure", "create a paper figure", "make a figure for my paper", "make a figure for my manuscript", "compose figure panels", "assemble figure panels", "combine figure panels", "make a multi-panel figure", "figure composition", "export a figure", "generate a PDF figure", "create a Nature-style figure", "make a journal figure", "make a publication figure", or "create a figure for my grant". The skill composes multi-panel figures at exact journal dimensions (Nature 89/183 mm, Science 55/120 mm, Cell 85/174 mm, PNAS 87/180 mm) using svgutils, validates font sizes against journal minima before export, and writes PDF/PNG via Inkscape when available or cairosvg otherwise./svg-figureThis skill should be used when the user asks to "create an SVG figure", "make a schematic", "draw a diagram", "create a schematic diagram", "draw a flowchart", "draw a process flow", "draw a workflow", "draw a workflow diagram", "make an SVG schematic", "create a process diagram", "create a pipeline diagram", "create a block diagram", "draw a system diagram", "system architecture diagram", "make this SVG editable in Illustrator", "prepare an SVG for Affinity Designer", "editor handoff", "Illustrator-friendly SVG", "hand off a figure to a designer", or wants a hand-authored or programmatic SVG with shapes, arrows, and labels that the figure-qa agent can verify. **For new Python-driven figures, route to `figures:svg-primitives` instead**, this skill is the conventions and hand-authoring reference. Outputs are SVG files that can be loaded as panel sources by the scientific-figure composer; `scripts/editor_prep.py` rewrites any finished SVG into the editor-safe dialect for Illustrator/Affinity handoff./svg-primitivesUse when the user asks to build a programmatic SVG schematic in Python: flowcharts, boxes and arrows, auto-fit SVG text, mm-precise diagrams, edge-snapped arrows, tangent-correct curve arrowheads, orthogonal or Manhattan routing, deterministic z-order layers, labeled groups, bracket groupings, leader-line annotations, or strict Canvas.save validation for text overflow. Use figure-qa instead for after-the-fact validation of arbitrary hand-authored or exported SVGs. Built on drawsvg, svgpathtools, and fontTools; output SVGs can be composed by scientific-figure.Other plugins' skills for the same job