Back to Skills

figure-generation

Generate publication-quality scientific figures using matplotlib/seaborn with a three-phase pipeline (query expansion, code generation with execution, VLM visual feedback). Handles bar charts, line plots, heatmaps, training curves, ablation plots, and more. Use when the user needs figures, plots, or visualizations for a paper.

250stars27forksUpdated 7/31/2026

Security Assessment

Safe(92/100)
Security Score92/100

About figure-generation

figure-generation is a workflow skill for producing publication-quality scientific figures for research papers using matplotlib and seaborn. It solves the problem of iteratively getting a plot right by structuring generation as a three-phase pipeline adapted from MatPlotAgent: query expansion, code generation with an execution loop, and visual refinement using vision-language-model (VLM) feedback.

In phase one it expands a natural-language figure description into detailed step-by-step coding specifications, determining figure type and data mapping. In phase two it generates a self-contained Python script from a provided template, writes it to a temp file and executes it, retrying up to four times by feeding back tracebacks or adding explicit save instructions until a PNG is produced. In phase three it reads the rendered PNG and inspects it against the request, checking figure type, labels, titles, legends, color scheme, and axis scales, then regenerates corrective code as needed. It supports many figure types (bar, training-curve, heatmap, ablation, line, scatter, radar, violin, tsne, attention), outputs both 300 DPI PNG and vector PDF plus LaTeX include code, and enforces quality requirements like colorblind-friendly palettes, minimum text size, and consistent styling.

It targets researchers, ML practitioners, and academic authors preparing figures for papers, and fits into a larger research-skill chain alongside data-analysis, experiment-code, paper-writing, and table-generation skills. The skill runs Python locally to execute generated plotting scripts, which is a standard and expected part of figure generation; the bundled prompts and template are for plotting only and contain no networking, credentials, or destructive operations.

FAQ

What figure types are supported?

bar, training-curve, heatmap, ablation, line, scatter, radar, violin, tsne, and attention, generated from a template script.

How does the generation loop work?

It uses a three-phase pipeline: expand the description into coding specs, generate and execute a Python script with up to four retries on errors or missing output, then visually inspect the rendered PNG and regenerate corrective code if needed.

What output formats does it produce?

A 300 DPI PNG preview and a vector PDF for the paper, along with LaTeX includegraphics code for the figure.

What are the prerequisites?

A Python environment with matplotlib and seaborn, since the skill writes and executes plotting scripts locally, and the ability to read back the generated PNG for visual refinement.

What quality standards does it enforce?

At least 300 DPI or vector output, colorblind-friendly palettes avoiding red-green only, text at least 8pt at print size, consistent styling across figures, and using LaTeX captions instead of matplotlib titles.

All Files

3 files
SKILL.md3.2 KB
View
scripts/figure_template.py11.1 KB
View
references/figure-prompts.md4.4 KB
View

Install figure-generation

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill