SuperAPI AI Directory

light-figure-drawing

Design & creation

View repository

Updated 10-15 20:24

About this skill

Professional Plotting and Figure Composition

Tool Selection (by figure type, with core calls)

  • Statistical plots/reproducible figures (first choice):
    • matplotlib: most controllable. Figure composition plt.subplots(figsize=(7,5), constrained_layout=True), for irregular layouts use GridSpec(spanning cells gs[0,:])。
    • seaborn: statistical/distribution/categorical plots.sns.set_theme(style="ticks", context="paper", palette="colorblind") + sns.despine(); for faceted composition use figure-level (relplot/catplot 's col=/row=), for manual composition use axes-level (scatterplot(ax=...))。
    • plotly: interactive/3D, static submission fig.write_image("f.pdf", scale=3)(requires kaleido),template="simple_white"。
    • altair: declarative, highly reproducible.chart.save("f.svg", scale_factor=3)(requires vl-convert-python), for composition use c1 | c2 / c1 & c2。
    • ggplot2(R):+ theme_classic() + scale_color_viridis_d(), for composition use patchwork(p1+p2 and plot_annotation(tag_levels="a") auto-numbering).
  • Framework diagrams/flowcharts/structural diagrams:
    • Graphviz(automatic layout):digraph{rankdir=LR; node[shape=box,style=rounded]; A->B}, choose the right engine dot(hierarchical)/neato(undirected)/fdp(large graphs),rank=same align same layer.
    • TikZ/PGFPlots(fonts unified with body text):\begin{axis}...\addplot table{data.dat};, preamble \pgfplotsset{compat=1.18} unified style, for large figures use external library caching.
    • Mermaid(documents/drafts):graph TD; A[框]-->|标签|B{判断},mmdc -i in.mmd -o out.svg export.
    • Fine retouching and layout: Illustrator / Inkscape.
  • Fine scientific figures/journal curves:
    • Origin: Export Graphs precisely sets Width/Height+DPI per publisher (TIFF 600dpi), can Export as AI convert to Illustrator; .otp templates lock in the style.
    • MATLAB:exportgraphics(ax,"f.pdf","ContentType","vector") outputs vector,"Resolution",600 outputs bitmap; for composition use tiledlayout + nexttile(TileSpacing="compact")。
  • Schematic/mechanism diagrams/graphical abstract:BioRender(life science icon library, note export licensing and resolution).
  • Figure composition/layout: matplotlib subplots/GridSpec, Illustrator (layers + artboard alignment), python-pptx (add_picture(..., width=Inches(3)), layout[6] blank page). Prefer reproducible (code) solutions, making it easy to re-output when data changes; for final retouching/composing large figures, then go into Illustrator/Inkscape. Specific decisions same as a09.

One-line journal style and export scripts (assets bundled with this skill)

  • Style:plt.style.use("assets/publication.mplstyle") is the general base; overlay per journal plt.style.use(["assets/publication.mplstyle","assets/nature.mplstyle"])(or science.mplstyle). All three are Okabe-Ito colorblind-safe color cycle + sans-serif + editable vector text (pdf/ps fonttype42, svg not converted to outlines).
  • Export:scripts/figure_export.py
    • save_publication_figure(fig, basename, formats=("pdf","png","svg"), dpi=600) multi-format + DPI, automatically creates directories, forces text to be editable.
    • save_for_journal(fig, basename, journal, column) sets physical dimensions per journal specs (mm→in) then exports, returns (paths, info)。
    • check_figure_size(fig, journal=, column=) validates column width (mm) and minimum font size (pt), returns a compliance report.
    • check_scaled_fonts(fig, journal=, column=) validates theeffective font sizeafter "drawing at large size then scaling down to column width"—whether it still meets the lower limit. Top journals often draw on a large canvas first then scale down to a single column; after scaling the font size shrinks proportionally, and this blind spot cannot be caught by check_figure_size.
    • JOURNAL_SPECS built-in per-journal spec dictionary (including verified markers).
  • Color scheme:scripts/color_palettes.py
    • OKABE_ITO / OKABE_ITO_LIST 8-color constants;sequential_cmap() / diverging_cmap() / discrete_cmap();apply_palette() sets the current color cycle.
    • to_grayscale()、simulate_cvd(kind=deuteranomaly/protanomaly/tritanomaly)、preview_palette() Output a control chart for the original color/grayscale/three types of color blindness. There is colorspacious uses an exact algorithm; if missing, it automatically degrades to a linear approximation (cvd_backend() can be checked).
  • Integrity lint:scripts/figure_integrity_lint.py — statically scans plotting code and flags common misleading practices: secretly truncated y-axis, dual y-axis false correlation, bars without error bars, error bars without specifying type, jet/rainbow colormaps, 3D distortion.python scripts/figure_integrity_lint.py --file plot.py(including --selftest). The specification is in references/figure_integrity.md. It only warns and does not block; the final judgment is left to the author.
  • Examples(all can be run with python examples/xxx.py and save figures with Agg):
    • example_matplotlib_multipanel.py: GridSpec irregular layout + (a)(b)(c) labels + error bars + significance stars.
    • example_seaborn_stats.py: box/violin/bar statistical comparison + despine.
    • example_framework.dot + example_framework_render.py: Graphviz framework diagram; if the dot binary is available it renders, otherwise it degrades to a matplotlib block diagram.

Per-journal hard specification table (column width mm + DPI + format + minimum font size)

The single source of truth for column-width numbers = scripts/figure_export.py in JOURNAL_SPECS; the table below is its human-readable mirror. If it is inconsistent with the script, the script prevails (to change numbers, change only the script). verified=actually tested: the journal's figure-specifications page was curled and the HTTP code recorded; the rest were compiled from public guidelines but not individually tested this time (mostly due to paywalls/anti-scraping 403). Before submission, please rely on the target journal's "latest" instructions for authors.

Journal Single-column width Double-column/full-page width Minimum font size Line art DPI Halftone/photo DPI Preferred format Measured
Nature 89 mm 183 mm 5 pt (panel labels 8 pt bold a,b,c; body text ≤7 pt) 600 300–600 PDF/TIFF/EPS (do not convert text to outlines, Helvetica/Arial) ✅ HTTP200
PLOS 83 mm 140 mm (1.5 columns) / 190 mm 8 pt(8–12pt,Arial/Times/Symbol) 600 300–600 TIFF/EPS only;789–2250px@300dpi,<10MB ✅ HTTP200
Science (AAAS) 55 mm (5.5cm) 120 mm (12 cm) / full page 183 mm (18.3 cm) 5 pt (usually 6–9 pt) 600 300 EPS/PDF/AI/TIFF, sans serif ✅ Three-tier system verified via multiple online sources (2026-06-11)
Cell Press 85 mm 174 mm 5 pt 1000 (line art) 300 PDF/AI/EPS/TIFF ⚠️ Page 403, not measured
IEEE 88.9 mm(3.5in) 181 mm(7.16in) 8 pt 600 300 PDF/EPS/TIFF ⚠️ Not individually measured
Elsevier 90 mm 140 mm (1.5 columns) / 190 mm 7 pt 1000 (line art) 300 (color/grayscale), combined 500 PDF/EPS/TIFF ⚠️ Page 404, not measured
MDPI 170 mm (single-column body width; figures at this width or integer fractions) 170 mm 8 pt 1000 (line/combined) 300 (photo) TIFF/PNG/EPS ⚠️ Paywall, not measured; includes db01's Animals/Agronomy/Sensors/Remote Sensing

custom escape hatch: for journals not yet in the table above (such as Chinese journals), use save_for_journal(fig, base, journal="custom", custom_width_mm=86.0) to directly pass the physical column width (mm); validation is likewise check_figure_size(fig, journal="custom", custom_width_mm=86.0)。Column-width data must have a source (db01 card or measured record); guessing is prohibited. Measured column widths for Chinese journals have been recorded in db01 risk_note (2026-06-11, measured with pdfplumber): Transactions of the Chinese Society of Agricultural Engineering single column 86 / full page 180; Scientia Agricultura Sinica and Acta Agronomica Sinica single column 81 / full page 170; Transactions of the Chinese Society for Agricultural Machinery pending verification (PDF entry blocked by anti-scraping).

Values are from the same source as JOURNAL_SPECS and can be read directly in code (e.g., figure_export.JOURNAL_SPECS["nature"])。

Aesthetics and specifications (submission-grade)

  • Color scheme: colorblind-friendly — for matplotlib/seaborn use viridis/cividis/colorblind, R uses scale_*_viridis, avoid jet/rainbow for continuous data. Use a unified palette within the same paper (register db07);If the project has databases/db09-projects/projects/<project_name>/palette.json , its colors must be used(a visual SSOT instance shared with PPT/frontend; take primary/accent/semantic colors as-is, do not create a separate set; see db09 README for schema). If not, use the recommended palette from the db07 card. Do not exceed the necessary number of colors (discrete ≤8 categories; specify manually if exceeded).
  • Fonts: consistent with the body text (usually Times/Arial); font size still readable after scaling (≥6–8pt). For seaborn use context="paper" to set the overall font size; set physical dimensions according to the target column width (single column ≈3.5in, double column ≈7.2in) to avoid distortion from scaling after submission.
  • Lines/markers: clearly distinguished, still distinguishable in black-and-white printing (dual distinction via linestyle + marker, not relying on color alone); use absolute values (pt) for line width.
  • Resolution/format: vector preferred (PDF/SVG/EPS); bitmap line art ≥600dpi, with photos ≥300dpi.Keep text editablefor easy secondary refinement: for matplotlib set rcParams["pdf.fonttype"]=42; for R use device=cairo_pdf; for MATLAB use exportgraphics ContentType=vector. EPS does not support transparency; for transparent backgrounds use PDF/SVG.
  • Elements: axis labels + units, legend, error bars, significance markers; remove chart junk (excess gridlines/borders,sns.despine() or theme_classic())。
  • caption: self-contained, understandable on its own.

Multi-panel logic

  • align similar panels, share axes/color scales, unify sizes. For matplotlib use constrained_layout to automatically align and share color scales; for ggplot use facet_* or patchwork; for MATLAB use tiledlayout。
  • subplot numbering (a)(b)(c), concise titles. patchwork tag_levels="a" can auto-number.
  • Use whitespace and grouping to convey hierarchy and highlight the main results.
  • Assemble the final large figure: export each subplot as vector (SVG/PDF) → place into Illustrator/Inkscape → layer management + Align + unify fonts and line widths → add labels → export per journal requirements (PDF/EPS/TIFF, often CMYK for print). For command-line assembly/format conversion, use Inkscape 1.x --export-type / --actions。

Pre-submission self-check list

  • Physical size = target column width? Font size ≥6–8pt after scaling?
  • Are colors colorblind-safe? Distinguishable in black-and-white printing (linestyle + marker)?
  • Vector output with editable text (fonttype42 / svg.fonttype=none / cairo_pdf / vector)? Bitmap dpi up to standard?
  • Do axes have labels + units? Are legend/error bars/significance markers complete? Is chart junk removed?
  • Honesty (do not mislead; reviewers will check): see references/figure_integrity.md, you can run scripts/figure_integrity_lint.py to scan plotting code. Key points: state in the caption whether error bars are SD/SEM/95%CI and write n=; y-axis truncation must explicitly mark the break (do not secretly truncate to exaggerate differences); use dual y-axes with caution (prone to creating spurious correlations; split them apart if possible); for small samples prefer scatter/box plots to show the raw distribution, do not use bars to hide the distribution; do not artificially tighten/enlarge axis ranges to exaggerate effects.
  • AI-generated images (2026 submission red line): Is this figure generated or tampered with using generative AI (DALL·E/Midjourney/SD/GPT Image, etc.)? Absolutely prohibited for data figures—the three leading publishers Nature/Science/Elsevier uniformly prohibit AI-generated paper images; the only exception is "AI itself is the research object/method" (must be reproducibly disclosed in methods). Paper figures are drawn data-driven using our own mplstyle; m16's R6 image-generation pipeline serves only PPT/frontend and is strictly prohibited from entering the paper figure pipeline. For policy details and differences in each publisher's stance, see references/figure_integrity.mdthe "AI-Generated Image Policy" section.
  • Is the whole paper's palette/font/line width consistent (compare with db07)?

Working method

Implement figure by figure according to m09's planning card (light-figure-planning/templates/figure_plan_card.md, narrative layer + spec layer dual-layer fields): provide runnable code or source file + preview description + design rationale. Read the upper narrative layer of the card to confirm the claim this figure is bound to and its role in the figure set; read the lower spec layer's source_card/target_journal/column and execute according to the card. When data is needed, retrieve it from m06/m02. Polish repeatedly until it reaches top-conference visual quality.

  • First read source_card (required): the planning card must carry source_card, pointing to databases/db07-figures/resources_real.md::figure_type or databases/db07-figures/figure_advanced_cards.md::figure_type。figure_cards.md is only a template index and cannot serve as an entity execution source; only source_card: new_canonical_candidate -> databases/db07-figures/resources_real.md(or databases/db07-figures/figure_advanced_cards.md) indicates that a new reusable pattern needs to be added and written back to db07.
  • Input field layering: db07 base fields control the chart pattern (figure_type/purpose/data_required/layout/...); project execution fields control delivery (figure_id/target_journal/column/caption_draft/output_formats). Do not write a single project's F1/F2, caption, or export path back into the db07 entity card.
  • Do not guess column width: directly read the planning card's target_journal and column fields and pass them as-is to save_for_journal(fig, basename, journal=target_journal, column=column)—physical column width in mm, figsize, and minimum font size are all locked by JOURNAL_SPECS . If the planning card lacks these two fields, go back to the planning skill (light-figure-planning) to fill them in; do not guess the column width yourself (a wrong guess invalidates the entire figure's physical dimensions).column The value must be an actual key of that journal (single/double/full/onehalf)。JOURNAL_SPECS currently contains nature/science/cell/plos/ieee/elsevier/mdpi seven keys; journals outside the table (such as Chinese journals) use the journal="custom"+custom_width_mm=<mm> escape hatch,column width data must have a source (db01 card or measured record); guessing is prohibited。
  • Must check after export: after each figure is exported, run check_figure_size(fig, journal=target_journal, column=column) and check_scaled_fonts(fig, journal=target_journal, column=column); if the code figure involves error bars, truncated axes, dual y-axes, jet/rainbow, etc., then use scripts/figure_integrity_lint.py --file <plot.py> for an honesty check.

Output

figure files (vector + raster) + generation code/source file + project style description (written to the repository root directory's databases/db09-projects/projects/<project_name>/version_history.md, for a07 to unify) + figure manifest(placed in the repository root directory's projects/<project_name>/figures/manifest.md). Only when a new cross-project reusable chart pattern has been added should the db07 canonical file be written back.

  • figure manifest: deliver m07's single artifact, binding "figure file ↔ figure number ↔ caption". One item per figure, including:figure_id(reusing m09 planning card's F#/T# numbering, aligned with m07 template [图位 F1]/[表位 T1] placeholders) + source_card + image file path (vector + raster) + final caption + placement section + target_journal/column + export/font size check results. Based on this, m07 replaces placeholders with actual figures and figure numbers, with no need to look back at the planning card. Example:
    - figure_id: F1
      source_card: databases/db07-figures/resources_real.md::模型框架图(architecture)
      files:
        vector: figs/framework.pdf
        bitmap: figs/framework.png
      caption: "图1. 方法整体框架:左输入经解耦表征模块……"
      section: 方法-框架
      target_journal: nature
      column: single
      checks:
        figure_size: pass
        scaled_fonts: pass
    

Connection

Driven by m09; handed to m12 for layout insertion; style consistency maintained across figures by a07. Patent drawings: When commissioned by m15 (light-ip-application) to draw, follow the "Patent Drawing Standards" section in references—black-and-white vector lines, figure numbering arrangement, reference lines not crossing, flowchart/block diagram terminology consistent with the claims, and do not apply the color scheme of paper data figures.


For item-by-item notes on the real APIs/parameters/export commands/known pitfalls of each tool, see references.md.