paper-figure
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePaper Figure: Publication-Quality Plots from Experiment Data
论文图表:基于实验数据生成出版级别的可视化图
Generate all figures and tables for a paper based on: $ARGUMENTS
基于**$ARGUMENTS**生成论文所需的所有图表与表格。
Scope: What This Skill Can and Cannot Do
适用范围:本技能能做什么,不能做什么
| Category | Can auto-generate? | Examples |
|---|---|---|
| Data-driven plots | ✅ Yes | Line plots (training curves), bar charts (method comparison), scatter plots, heatmaps, box/violin plots |
| Comparison tables | ✅ Yes | LaTeX tables comparing prior bounds, method features, ablation results |
| Multi-panel figures | ✅ Yes | Subfigure grids combining multiple plots (e.g., 3×3 dataset × method) |
| Architecture/pipeline diagrams | ❌ No — manual | Model architecture, data flow diagrams, system overviews. At best can generate a rough TikZ skeleton, but expect to draw these yourself using tools like draw.io, Figma, or TikZ |
| Generated image grids | ❌ No — manual | Grids of generated samples (e.g., GAN/diffusion outputs). These come from running your model, not from this skill |
| Photographs / screenshots | ❌ No — manual | Real-world images, UI screenshots, qualitative examples |
In practice: For a typical ML paper, this skill handles ~60% of figures (all data plots + tables). The remaining ~40% (hero figure, architecture diagram, qualitative results) need to be created manually and placed in before running . The skill will detect these as "existing figures" and preserve them.
figures//paper-write| 类别 | 能否自动生成? | 示例 |
|---|---|---|
| 数据驱动型图表 | ✅ 可以 | 折线图(训练曲线)、柱状图(方法对比)、散点图、热力图、箱线图/小提琴图 |
| 对比表格 | ✅ 可以 | 用于对比现有边界、方法特性、消融实验结果的LaTeX表格 |
| 多面板组合图 | ✅ 可以 | 组合多个子图的网格布局(例如3×3的数据集×方法对比图) |
| 架构/流程图 | ❌ 不可以 — 需手动制作 | 模型架构图、数据流图、系统概览图。最多只能生成一个粗略的TikZ框架,但建议你使用draw.io、Figma或TikZ等工具手动绘制 |
| 生成图像网格 | ❌ 不可以 — 需手动制作 | 生成样本的网格图(例如GAN/扩散模型的输出结果)。这类图来自你的模型运行结果,而非本技能生成 |
| 照片/截图 | ❌ 不可以 — 需手动制作 | 真实世界图像、UI截图、定性示例 |
实际应用: 对于一篇典型的机器学习论文,本技能可处理约60%的图表(所有数据类图表+表格)。剩余约40%的内容(核心展示图、架构图、定性结果图)需要手动制作并放入目录后,再运行。本技能会将这些检测为“已存在的图表”并保留它们。
figures//paper-writeConstants
常量参数
- STYLE = — Visual style preset. Options:
publication(default, clean for print),publication(larger fonts),poster(bold colors)slide - DPI = 300 — Output resolution
- FORMAT = — Output format. Options:
pdf(vector, best for LaTeX),pdf(raster fallback)png - COLOR_PALETTE = — Default matplotlib color cycle. Options:
tab10,tab10,Set2(deuteranopia-safe)colorblind - FONT_SIZE = 10 — Base font size (matches typical conference body text)
- FIG_DIR = — Output directory for generated figures
figures/ - REVIEWER_MODEL = — Model used via Codex MCP for figure quality review.
gpt-5.4
- STYLE = — 可视化风格预设。可选值:
publication(默认,适合印刷的简洁风格)、publication(更大字体)、poster(醒目色彩)slide - DPI = 300 — 输出分辨率
- FORMAT = — 输出格式。可选值:
pdf(矢量图,最适合LaTeX)、pdf(栅格图备选)png - COLOR_PALETTE = — 默认matplotlib配色循环。可选值:
tab10、tab10、Set2(适合红绿色盲人群)colorblind - FONT_SIZE = 10 — 基础字体大小(匹配常规会议论文的正文字号)
- FIG_DIR = — 生成图表的输出目录
figures/ - REVIEWER_MODEL = — 通过Codex MCP用于图表质量审核的模型。
gpt-5.4
Inputs
输入要求
- PAPER_PLAN.md — figure plan table (from )
/paper-plan - Experiment data — JSON files, CSV files, or screen logs in or project root
figures/ - Existing figures — any manually created figures to preserve
If no PAPER_PLAN.md exists, scan for data files and ask the user which figures to generate.
- PAPER_PLAN.md — 图表规划表(来自)
/paper-plan - 实验数据 — JSON文件、CSV文件或屏幕日志,存放在目录或项目根目录
figures/ - 已存在的图表 — 任何需要保留的手动制作图表
如果不存在PAPER_PLAN.md,则扫描数据文件并询问用户需要生成哪些图表。
Workflow
工作流程
Step 1: Read Figure Plan
步骤1:读取图表规划表
Parse the Figure Plan table from PAPER_PLAN.md:
markdown
| ID | Type | Description | Data Source | Priority |
|----|------|-------------|-------------|----------|
| Fig 1 | Architecture | ... | manual | HIGH |
| Fig 2 | Line plot | ... | figures/exp.json | HIGH |Identify:
- Which figures can be auto-generated from data
- Which need manual creation (architecture diagrams, etc.)
- Which are comparison tables (generate as LaTeX)
解析PAPER_PLAN.md中的图表规划表:
markdown
| ID | 类型 | 描述 | 数据源 | 优先级 |
|----|------|-------------|-------------|----------|
| Fig 1 | 架构图 | ... | 手动制作 | HIGH |
| Fig 2 | 折线图 | ... | figures/exp.json | HIGH |识别:
- 哪些图表可以从数据自动生成
- 哪些需要手动制作(架构图等)
- 哪些是对比表格(需生成为LaTeX格式)
Step 2: Set Up Plotting Environment
步骤2:配置绘图环境
Create a shared style configuration script:
python
undefined创建共享的风格配置脚本:
python
undefinedpaper_plot_style.py — shared across all figure scripts
paper_plot_style.py — 所有图表脚本共享的配置
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({
'font.size': FONT_SIZE,
'font.family': 'serif',
'font.serif': ['Times New Roman', 'Times', 'DejaVu Serif'],
'axes.labelsize': FONT_SIZE,
'axes.titlesize': FONT_SIZE + 1,
'xtick.labelsize': FONT_SIZE - 1,
'ytick.labelsize': FONT_SIZE - 1,
'legend.fontsize': FONT_SIZE - 1,
'figure.dpi': DPI,
'savefig.dpi': DPI,
'savefig.bbox': 'tight',
'savefig.pad_inches': 0.05,
'axes.grid': False,
'axes.spines.top': False,
'axes.spines.right': False,
'text.usetex': False, # set True if LaTeX is available
'mathtext.fontset': 'stix',
})
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams.update({
'font.size': FONT_SIZE,
'font.family': 'serif',
'font.serif': ['Times New Roman', 'Times', 'DejaVu Serif'],
'axes.labelsize': FONT_SIZE,
'axes.titlesize': FONT_SIZE + 1,
'xtick.labelsize': FONT_SIZE - 1,
'ytick.labelsize': FONT_SIZE - 1,
'legend.fontsize': FONT_SIZE - 1,
'figure.dpi': DPI,
'savefig.dpi': DPI,
'savefig.bbox': 'tight',
'savefig.pad_inches': 0.05,
'axes.grid': False,
'axes.spines.top': False,
'axes.spines.right': False,
'text.usetex': False, # 如果有LaTeX环境则设为True
'mathtext.fontset': 'stix',
})
Color palette
配色方案
COLORS = plt.cm.tab10.colors # or Set2, or colorblind-safe
def save_fig(fig, name, fmt=FORMAT):
"""Save figure to FIG_DIR with consistent naming."""
fig.savefig(f'{FIG_DIR}/{name}.{fmt}')
print(f'Saved: {FIG_DIR}/{name}.{fmt}')
undefinedCOLORS = plt.cm.tab10.colors # 或Set2,或色盲友好配色
def save_fig(fig, name, fmt=FORMAT):
"""将图表保存到FIG_DIR目录,命名保持一致。"""
fig.savefig(f'{FIG_DIR}/{name}.{fmt}')
print(f'已保存: {FIG_DIR}/{name}.{fmt}')
undefinedStep 3: Auto-Select Figure Type
步骤3:自动选择图表类型
Use this decision tree for data-driven figures (inspired by Imbad0202/academic-research-skills):
| Data Pattern | Recommended Type | Size |
|---|---|---|
| X=time/steps, Y=metric | Line plot | 0.48\textwidth |
| Methods × 1 metric | Bar chart | 0.48\textwidth |
| Methods × multiple metrics | Grouped bar / radar | 0.95\textwidth |
| Two continuous variables | Scatter plot | 0.48\textwidth |
| Matrix / grid values | Heatmap | 0.48\textwidth |
| Distribution comparison | Box/violin plot | 0.48\textwidth |
| Multi-dataset results | Multi-panel (subfigure) | 0.95\textwidth |
| Prior work comparison | LaTeX table | — |
使用以下决策树选择数据驱动型图表的类型(灵感来自Imbad0202/academic-research-skills):
| 数据模式 | 推荐图表类型 | 尺寸 |
|---|---|---|
| X=时间/步数,Y=指标 | 折线图 | 0.48\textwidth |
| 方法 × 1个指标 | 柱状图 | 0.48\textwidth |
| 方法 × 多个指标 | 分组柱状图 / 雷达图 | 0.95\textwidth |
| 两个连续变量 | 散点图 | 0.48\textwidth |
| 矩阵/网格值 | 热力图 | 0.48\textwidth |
| 分布对比 | 箱线图/小提琴图 | 0.48\textwidth |
| 多数据集结果 | 多面板组合图(子图) | 0.95\textwidth |
| 现有工作对比 | LaTeX表格 | — |
Step 4: Generate Each Figure
步骤4:生成每个图表
For each figure in the plan, create a standalone Python script:
Line plots (training curves, scaling):
python
undefined为规划表中的每个图表创建独立的Python脚本:
折线图(训练曲线、缩放趋势):
python
undefinedgen_fig2_training_curves.py
gen_fig2_training_curves.py
from paper_plot_style import *
import json
with open('figures/exp_results.json') as f:
data = json.load(f)
fig, ax = plt.subplots(1, 1, figsize=(5, 3.5))
ax.plot(data['steps'], data['fac_loss'], label='Factorized', color=COLORS[0])
ax.plot(data['steps'], data['crf_loss'], label='CRF-LR', color=COLORS[1])
ax.set_xlabel('Training Steps')
ax.set_ylabel('Cross-Entropy Loss')
ax.legend(frameon=False)
save_fig(fig, 'fig2_training_curves')
**Bar charts** (comparison, ablation):
```python
fig, ax = plt.subplots(1, 1, figsize=(5, 3))
methods = ['Baseline', 'Method A', 'Method B', 'Ours']
values = [82.3, 85.1, 86.7, 89.2]
bars = ax.bar(methods, values, color=[COLORS[i] for i in range(len(methods))])
ax.set_ylabel('Accuracy (%)')from paper_plot_style import *
import json
with open('figures/exp_results.json') as f:
data = json.load(f)
fig, ax = plt.subplots(1, 1, figsize=(5, 3.5))
ax.plot(data['steps'], data['fac_loss'], label='Factorized', color=COLORS[0])
ax.plot(data['steps'], data['crf_loss'], label='CRF-LR', color=COLORS[1])
ax.set_xlabel('训练步数')
ax.set_ylabel('交叉熵损失')
ax.legend(frameon=False)
save_fig(fig, 'fig2_training_curves')
**柱状图**(方法对比、消融实验):
```python
fig, ax = plt.subplots(1, 1, figsize=(5, 3))
methods = ['Baseline', 'Method A', 'Method B', 'Ours']
values = [82.3, 85.1, 86.7, 89.2]
bars = ax.bar(methods, values, color=[COLORS[i] for i in range(len(methods))])
ax.set_ylabel('准确率 (%)')Add value labels on bars
在柱子上添加数值标签
for bar, val in zip(bars, values):
ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 0.3,
f'{val:.1f}', ha='center', va='bottom', fontsize=FONT_SIZE-1)
save_fig(fig, 'fig3_comparison')
**Comparison tables** (LaTeX, for theory papers):
```latex
\begin{table}[t]
\centering
\caption{Comparison of estimation error bounds. $n$: sample size, $D$: ambient dim, $d$: latent dim, $K$: subspaces, $n_k$: modes.}
\label{tab:bounds}
\begin{tabular}{lccc}
\toprule
Method & Rate & Depends on $D$? & Multi-modal? \\
\midrule
\citet{MinimaxOkoAS23} & $n^{-s'/D}$ & Yes (curse) & No \\
\citet{ScoreMatchingdistributionrecovery} & $n^{-2/d}$ & No & No \\
\textbf{Ours} & $\sqrt{\sum n_k d_k / n}$ & No & Yes \\
\bottomrule
\end{tabular}
\end{table}Architecture/pipeline diagrams (MANUAL — outside this skill's scope):
- These require manual creation using draw.io, Figma, Keynote, or TikZ
- This skill can generate a rough TikZ skeleton as a starting point, but do not expect publication-quality results
- If the figure already exists in , preserve it and generate only the LaTeX
figures/snippet\includegraphics - Flag as in the figure plan and
[MANUAL]latex_includes.tex
for bar, val in zip(bars, values):
ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 0.3,
f'{val:.1f}', ha='center', va='bottom', fontsize=FONT_SIZE-1)
save_fig(fig, 'fig3_comparison')
**对比表格**(LaTeX格式,适用于理论论文):
```latex
\begin{table}[t]
\centering
\caption{估计误差边界对比。$n$: 样本量, $D$: 环境维度, $d$: 潜在维度, $K$: 子空间, $n_k$: 模式。}
\label{tab:bounds}
\begin{tabular}{lccc}
\toprule
方法 & 速率 & 是否依赖$D$? & 多模式支持? \\
\midrule
\citet{MinimaxOkoAS23} & $n^{-s'/D}$ & 是(维度灾难) & 否 \\
\citet{ScoreMatchingdistributionrecovery} & $n^{-2/d}$ & 否 & 否 \\
\textbf{本文方法} & $\sqrt{\sum n_k d_k / n}$ & 否 & 是 \\
\bottomrule
\end{tabular}
\end{table}架构/流程图(手动制作 — 超出本技能范围):
- 需要使用draw.io、Figma、Keynote或TikZ手动制作
- 本技能可生成一个粗略的TikZ框架作为起点,但无法直接生成达到出版级别的结果
- 如果图表已存在于目录中,则保留该图表并仅生成LaTeX的
figures/代码片段\includegraphics - 在图表规划表和中标记为
latex_includes.tex[MANUAL]
Step 5: Run All Scripts
步骤5:运行所有脚本
bash
undefinedbash
undefinedRun all figure generation scripts
运行所有图表生成脚本
for script in gen_fig*.py; do
python "$script"
done
Verify all output files exist and are non-empty.for script in gen_fig*.py; do
python "$script"
done
验证所有输出文件存在且非空。Step 6: Generate LaTeX Include Snippets
步骤6:生成LaTeX引用代码片段
For each figure, output the LaTeX code to include it:
latex
% === Fig 2: Training Curves ===
\begin{figure}[t]
\centering
\includegraphics[width=0.48\textwidth]{figures/fig2_training_curves.pdf}
\caption{Training curves comparing factorized and CRF-LR denoising.}
\label{fig:training_curves}
\end{figure}Save all snippets to for easy copy-paste into the paper.
figures/latex_includes.tex为每个图表输出用于引用的LaTeX代码:
latex
% === Fig 2: 训练曲线 ===
\begin{figure}[t]
\centering
\includegraphics[width=0.48\textwidth]{figures/fig2_training_curves.pdf}
\caption{对比分解式和CRF-LR去噪的训练曲线。}
\label{fig:training_curves}
\end{figure}将所有代码片段保存到,以便轻松复制粘贴到论文中。
figures/latex_includes.texStep 7: Figure Quality Review with REVIEWER_MODEL
步骤7:使用REVIEWER_MODEL进行图表质量审核
Send figure descriptions and captions to GPT-5.4 for review:
mcp__codex__codex:
model: gpt-5.4
config: {"model_reasoning_effort": "xhigh"}
prompt: |
Review these figure/table plans for a [VENUE] submission.
For each figure:
1. Is the caption informative and self-contained?
2. Does the figure type match the data being shown?
3. Is the comparison fair and clear?
4. Any missing baselines or ablations?
5. Would a different visualization be more effective?
[list all figures with captions and descriptions]将图表描述和标题发送给GPT-5.4进行审核:
mcp__codex__codex:
model: gpt-5.4
config: {"model_reasoning_effort": "xhigh"}
prompt: |
审核这些用于[VENUE]投稿的图表/表格规划。
针对每个图表:
1. 标题是否信息丰富且独立完整?
2. 图表类型是否与展示的数据匹配?
3. 对比是否公平清晰?
4. 是否缺少基线或消融实验?
5. 是否有更有效的可视化方式?
[列出所有图表的标题和描述]Step 8: Quality Checklist
步骤8:质量检查清单
Before finishing, verify each figure (from pedrohcgs/claude-code-my-workflow):
- Font size readable at printed paper size (not too small)
- Colors distinguishable in grayscale (print-friendly)
- No title inside figures — titles go only in LaTeX (from pedrohcgs)
\caption{} - Legend does not overlap data
- Axis labels have units where applicable
- Axis labels are publication-quality (not variable names like )
emp_rate - Figure width fits single column (0.48\textwidth) or full width (0.95\textwidth)
- PDF output is vector (not rasterized text)
- No matplotlib default title (remove for publications)
plt.title - Serif font matches paper body text (Times / Computer Modern)
- Colorblind-accessible (if using colorblind palette)
完成前,验证每个图表(参考pedrohcgs/claude-code-my-workflow):
- 字体大小在打印后可读(不要过小)
- 颜色在灰度模式下可区分(适合印刷)
- 图表内部不要加标题 — 标题仅放在LaTeX的中(来自pedrohcgs)
\caption{} - 图例不与数据重叠
- 坐标轴标签在必要时包含单位
- 坐标轴标签达到出版级别(不要使用这类变量名)
emp_rate - 图表宽度适配单栏(0.48\textwidth)或全宽度(0.95\textwidth)
- PDF输出为矢量图(不是栅格化的文本)
- 没有matplotlib默认标题(移除以符合出版要求)
plt.title - 衬线字体与论文正文字体匹配(Times / Computer Modern)
- 色盲友好(如果使用色盲友好配色)
Output
输出目录结构
figures/
├── paper_plot_style.py # shared style config
├── gen_fig1_architecture.py # per-figure scripts
├── gen_fig2_training_curves.py
├── gen_fig3_comparison.py
├── fig1_architecture.pdf # generated figures
├── fig2_training_curves.pdf
├── fig3_comparison.pdf
├── latex_includes.tex # LaTeX snippets for all figures
└── TABLE_*.tex # standalone table LaTeX filesfigures/
├── paper_plot_style.py # 共享风格配置
├── gen_fig1_architecture.py # 每个图表对应的脚本
├── gen_fig2_training_curves.py
├── gen_fig3_comparison.py
├── fig1_architecture.pdf # 生成的图表
├── fig2_training_curves.pdf
├── fig3_comparison.pdf
├── latex_includes.tex # 所有图表的LaTeX引用片段
└── TABLE_*.tex # 独立的LaTeX表格文件Key Rules
核心规则
- Every figure must be reproducible — save the generation script alongside the output
- Do NOT hardcode data — always read from JSON/CSV files
- Use vector format (PDF) for all plots — PNG only as fallback
- No decorative elements — no background colors, no 3D effects, no chart junk
- Consistent style across all figures — same fonts, colors, line widths
- Colorblind-safe — verify with https://davidmathlogic.com/colorblind/ if needed
- One script per figure — easy to re-run individual figures when data changes
- No titles inside figures — captions are in LaTeX only
- Comparison tables count as figures — generate them as standalone .tex files
- 每个图表必须可复现 — 将生成脚本与输出文件保存在一起
- 不要硬编码数据 — 始终从JSON/CSV文件读取数据
- 所有图表使用矢量格式(PDF) — PNG仅作为备选
- 不要添加装饰元素 — 无背景色、无3D效果、无冗余图表元素
- 所有图表风格一致 — 相同字体、颜色、线条宽度
- 色盲友好 — 必要时使用https://davidmathlogic.com/colorblind/验证
- 一个图表对应一个脚本 — 数据变化时可轻松重新生成单个图表
- 图表内部不要加标题 — 标题仅放在LaTeX中
- 对比表格视为图表的一部分 — 生成为独立的.tex文件
Figure Type Reference
图表类型参考
| Type | When to Use | Typical Size |
|---|---|---|
| Line plot | Training curves, scaling trends | 0.48\textwidth |
| Bar chart | Method comparison, ablation | 0.48\textwidth |
| Grouped bar | Multi-metric comparison | 0.95\textwidth |
| Scatter plot | Correlation analysis | 0.48\textwidth |
| Heatmap | Attention, confusion matrix | 0.48\textwidth |
| Box/violin | Distribution comparison | 0.48\textwidth |
| Architecture | System overview | 0.95\textwidth |
| Multi-panel | Combined results (subfigures) | 0.95\textwidth |
| Comparison table | Prior bounds vs. ours (theory) | full width |
| 类型 | 使用场景 | 典型尺寸 |
|---|---|---|
| 折线图 | 训练曲线、缩放趋势 | 0.48\textwidth |
| 柱状图 | 方法对比、消融实验 | 0.48\textwidth |
| 分组柱状图 | 多指标对比 | 0.95\textwidth |
| 散点图 | 相关性分析 | 0.48\textwidth |
| 热力图 | 注意力机制、混淆矩阵 | 0.48\textwidth |
| 箱线图/小提琴图 | 分布对比 | 0.48\textwidth |
| 架构图 | 系统概览 | 0.95\textwidth |
| 多面板组合图 | 组合结果(子图) | 0.95\textwidth |
| 对比表格 | 现有边界与本文方法对比(理论论文) | 全宽度 |
Acknowledgements
致谢
Design pattern (type × style matrix) inspired by baoyu-skills. Publication style defaults and figure rules from pedrohcgs/claude-code-my-workflow. Visualization decision tree from Imbad0202/academic-research-skills.
设计模式(类型×风格矩阵)灵感来自baoyu-skills。出版风格默认设置和图表规则来自pedrohcgs/claude-code-my-workflow。可视化决策树来自Imbad0202/academic-research-skills。