Skip to content
项目

关于

NaturePanelForge is a code-first workflow for turning scientific figure images and open-access Nature-family papers into panel-level, executable plotting-code reconstruction tasks.

科学与工程

这些数字如何统计

实测星标增长

24小时
0
7天
+1
15天
+2
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.zh-CN.md

原文

NaturePanelForge icon
NaturePanelForge

把 Nature 级别科学论文图转化为可执行绘图代码。
自动检索开放获取论文,下载全文图,切分 panel,调用 Qwen 进行图像类型与质量评分,并通过 Codex agent loop 复现统计图代码。

Project page Gallery live demo Usage four modes Agent loop refine Method and stats Codex skill install

NaturePanelForge input-output schematic: target scientific panel and optional metadata are converted into runnable Python plotting code.

使用方式 | 快速上手 | Agent Workflow | 复现示例 | 环境配置 | 方法与统计 | 教程

English | 中文

NaturePanelForge 是一个 code-first 工作流,用于把真实科学论文图像和开放获取 Nature 系列论文转化为 panel 级别、可执行绘图代码复现任务。本仓库代码不依赖线上 gallery demo。

NaturePanelForge gallery walkthrough

Watch walkthrough video

NaturePanelForge gallery home

NaturePanelForge gallery catalog

项目介绍、方法、当前数据量、Qwen 分数分布和 Codex refine 复杂度分布见 Introduction and Methods。

快速上手

快速上手展示两条简单路径:

模式 1. 直接代码模式

直接运行仓库里已经提交的绘图代码。 这是最快路径:不需要重新跑 Codex loop,也不需要安装 skill。

直接代码模式原图 直接代码模式复现图
Direct code mode target GO enrichment bubble plot panel Direct code mode reproduced GO enrichment bubble plot panel

一句命令运行:

bash scripts/run_quick_start_demo.sh

会重新渲染已提交的脚本和图片:

docs/demo/quick_start_bubble_plot/reproduce_panel.py
docs/demo/quick_start_bubble_plot/reproduce_panel.png
docs/demo/quick_start_bubble_plot/reproduce_panel.pdf

模式 2. 安装 Codex Skill 模式

先安装仓库附带的 Code Skill,然后在 Codex 里粘贴完整 System Prompt 来跑。 Codex 会用 codex-panel-reproduce 读取原图、写出可编辑 Python/matplotlib 代码、渲染复现图/PDF,并保存 review 文件。

Codex Skill 模式原图 Codex Skill 模式复现图
Codex Skill mode target GO enrichment bubble plot panel Codex Skill mode reproduced GO enrichment bubble plot panel

安装 Skill Prompt:

Install the NaturePanelForge Codex skill for me: https://github.com/littlepeachs/NaturePanelForge

Codex 会读取这个仓库,安装仓库附带的 codex-panel-reproduce skill,并检查本地是否安装成功。

中文 System Prompt:

请使用已安装的 codex-panel-reproduce skill,帮我复现这个科学论文 panel 图像为可编辑的 Python/matplotlib 代码。

目标图像:docs/demo/quick_start_skill_bubble_plot/target.png
可选 PDF:docs/demo/quick_start_skill_bubble_plot/target.pdf
输出根目录:UserRuns/my_skill_test
panel id:my_skill_test
图类型:bubble_plot
caption:A faceted GO enrichment bubble plot with Human and Mouse columns, biological process labels on the left, x axis as -log10(p.value), bubble size encoding log10(count), and colors encoding biological groups.

要求:
1. 使用 codex-panel-reproduce skill。
2. 不要使用 Qwen scoring,这是本地用户提供的图片。
3. 不要手工修改图片,只生成可执行绘图代码。
4. 运行 NaturePanelForge 的单图复现 workflow。
5. 生成 reproduce_panel.py、reproduce_panel.png、reproduce_panel.pdf。
6. 生成 review notes、review summary、run log。
7. 最后告诉我输出目录、review_passed、contract_passed、最终 PNG 尺寸和重新渲染命令。

English System Prompt:

Please use the installed codex-panel-reproduce skill to reproduce this scientific paper panel as editable Python/matplotlib code.

Target image: docs/demo/quick_start_skill_bubble_plot/target.png
Optional PDF: docs/demo/quick_start_skill_bubble_plot/target.pdf
Output root: UserRuns/my_skill_test
Panel id: my_skill_test
Chart type: bubble_plot
Caption: A faceted GO enrichment bubble plot with Human and Mouse columns, biological process labels on the left, x axis as -log10(p.value), bubble size encoding log10(count), and colors encoding biological groups.

Requirements:
1. Use the codex-panel-reproduce skill.
2. Do not use Qwen scoring; this is a local user-supplied image.
3. Do not manually modify images; generate executable plotting code only.
4. Run the NaturePanelForge single-panel reproduction workflow.
5. Generate reproduce_panel.py, reproduce_panel.png, and reproduce_panel.pdf.
6. Generate review notes, review summary, and run log.
7. Finally report the output directory, review_passed, contract_passed, final PNG size, and rerender command.

原图就是输入,复现图就是期望得到的可编辑代码输出。完整 prompt 文件也保留在 中文 prompt 和 English prompt。

不跑 Codex 时,也可以离线重渲染已提交的 Skill 模式结果:

DEMO_CASE=quick_start_skill_bubble_plot bash scripts/run_quick_start_demo.sh

如果你想把自己的数据画成同样风格,可以直接修改任一 demo 的 reproduce_panel.py 数据数组和标签,然后重新运行脚本。如果目标是“拿一张参考论文图,把自己的新数据画成类似风格”,FigMirror 更像面向普通研究者的产品;NaturePanelForge 的重点是从真实论文图构建 scientific panel-to-code benchmark。

Agent Workflow

NaturePanelForge 使用三个可恢复的 agent 阶段。每个阶段都会把中间产物、审核结果和最终文件落盘。

NaturePanelForge complete workflow

Panel Split 将完整复合图切分为干净 panel crop。执行 agent 生成切图逻辑和 crop/spec 文件,review agent 检查 panel 字母、坐标轴标签、tick、legend、colorbar、标题、annotation 和边界可见性。

Code Reproduce 将目标 panel 转化为 reproduce_panel.py、reproduce_panel.png 和 reproduce_panel.pdf。代码 agent 负责绘图,review agent 对比 target.png 与复现图;如果发现可修复问题,就继续修改代码并重新渲染。

Final Refine 从已经通过首轮 review 的复现结果出发,进一步精修。refine agent 在原有代码上编辑,audit agent 检查 Arial 字体、label/tick/legend 重叠、科学符号、边缘截断、布局紧凑度、复杂度评分和 caption 摘要。

Agent loops for high-fidelity panel-to-code reproduction

这个 agent loop 是高质量 panel-to-code 复现的核心机制:每个阶段都把“执行”和“审核”拆开,通过多轮反馈迭代,直到 panel 划分、代码复现或最终精修通过对应审核。

Codex 复现示例

下图展示真实论文目标 panel 与 Codex 渲染结果的并排对比。所有复现结果都来自可执行绘图代码,不是手工图片修补。

Target panels beside Codex reproductions

使用方式

统一入口是 forge.py。四种公开使用模式都可以一行命令启动。

  1. 单个裁剪 panel 图像 -> 绘图代码
python3 forge.py single-panel-image --image /path/to/target_panel.png --panel-id demo_panel --chart-type bar --caption "A grouped bar chart with error bars and a legend." --out-root UserRuns/panel_demo --model gpt-5.4 --reasoning-effort medium --review-rounds 4 --skip-existing
  1. 单张完整复合图 -> reviewed panel crops
python3 forge.py single-full-image --image /path/to/full_figure.png --paper-id demo_paper --caption "A complete multi-panel scientific figure." --out-root UserRuns/full_demo --model gpt-5.4 --reasoning-effort medium --review-rounds 4 --skip-existing
  1. 单篇论文 -> 论文元数据与 full figures
python3 forge.py single-paper --doi 10.1038/s41467-025-12345-6 --subject biology --topic AI_biology --figures-per-paper 5 --download-only
  1. 批量论文 -> 完整 paper-to-panel-to-code 流程
python3 forge.py batched-paper --subject materials --topic AI_materials --target-papers 20 --batch-size 20 --figures-per-paper 5 --years 2024,2025,2026 --codex-model gpt-5.4 --codex-jobs 8

仓库根目录只保留一个公开 Python 入口 forge.py。内部 pipeline 模块位于 nature_panel_forge/,阶段封装脚本位于 scripts/。

single-panel-image 是最直接的用户端 image-to-code 路径。一次真实运行会返回:

target.png
metadata.json
qwen_score.json
reproduce_panel.py
reproduce_panel.png
reproduce_panel.pdf
user_reproduce_summary.json
result.json

user_reproduce_summary.json 和 result.json 会记录生成代码、输出路径、review 状态、缺失文件检查,以及 live contract 是否通过。dry-run 会显式设置 live_contract_checked=false 和 contract_passed=false。

环境配置

cd NaturePanelForge
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp configs/demo.env.example .env
source .env

外部依赖:

  • 下载论文和图片需要网络访问
  • panel split、reproduce、refine 需要 Codex CLI
  • panel 分类和评分需要本地 Qwen vision 模型

检查 Codex:

codex --version

设置 Qwen:

export QWEN_MODEL_PATH=/path/to/Qwen3.6-27B
export CUDA_VISIBLE_DEVICES=0

默认 Qwen 路径使用本地 transformers 加载,即 --qwen-backend transformers。--qwen-backend openai 只是给主动使用 OpenAI-compatible vision endpoint 的用户保留的兼容接口。

安装 Codex Skill

最简单的方式是让 Codex 直接根据这个 GitHub 仓库安装。已经在 Codex 里?直接粘贴这个 prompt:

安装 Skill Prompt:

Install the NaturePanelForge Codex skill for me: https://github.com/littlepeachs/NaturePanelForge

Codex 应该 clone 或打开这个仓库,把 skills/codex-panel-reproduce/SKILL.md 安装到本地 Codex skills 目录,并检查这个文件是否存在:

${CODEX_HOME:-$HOME/.codex}/skills/codex-panel-reproduce/SKILL.md

安装后,使用 Quick Start Mode 2 里展示的完整中文或英文 System Prompt。

本地 Codex 就可以读取 codex-panel-reproduce skill,并按单 panel 复现和 refine 工作流执行。

仓库结构

forge.py                            # 单一公开 Python CLI 入口
nature_panel_forge/                 # 内部 paper、figure、export、refine、image-to-code 模块
agent_loop/                         # Codex panel split、manifest 构建、Qwen scoring
examples/                           # Codex reproduce 与 final-refine 批处理驱动
scripts/                            # 可移植阶段 wrapper 和 skill installer
gallery/                            # 静态 gallery 外壳与 catalog builder
skills/                             # 本地 Codex skill package
configs/                            # 环境变量模板
docs/                               # 架构、方法与视觉资源
prompts/                            # agent prompt 蓝图

生成的 run 目录大致如下:

PipelineRuns/<subject>/<topic>/run_YYYYMMDD_HHMMSS_batch001/
  Papers/
  FullFigures/full_figures.csv
  Panels_codex_full/
  PanelReviews_codex_full/
  QwenPanelScore/
  Final_Schematic/
  Reproduce_Statistical/
  Reproduce_Statistical_Reviews/
  Reproduce_Statistical_Refined/

更多文档

Citation

如果你在论文或 benchmark 中使用本工作流,请引用项目仓库,并明确说明论文来源、模型版本、评分阈值和 Codex review 轮次设置。

探索相关项目

加载中…