figforge/README.md

52 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# figforge
期刊级科研配图生成器 GitLink AI Agent Skill。照投稿要求把数据画成多面板论文插图300 DPI、克制配色、统一字号、去顶/右脊线、a/b/c 面板标号。
GitLink 智能化服务开源项目贡献赛 **子赛题二(编写和丰富 GitLink Skills** 参赛作品。作者Ct201314
## 它解决什么
期刊图的字号、配色、排版规矩多,手动调 matplotlib 容易调到半夜。`figforge` 一次对齐:
- **期刊样式表**:固化 300 DPI、克制配色、去脊、统一字号的 rcParams
- **多种图型**:柱状(含误差棒)、折线(多序列)、散点、箱线
- **多面板组合**:多图按行列拼成 Figure自动加 (a)(b)(c) 标号
## 设计特点
用一份 JSON 描述「要哪几个面板、各画什么」,工具自动套样式、排布局、加标号、导出 300 DPI。中文用 SimHei 直配 rcParams不套 SciencePlots避免字体冲突乱码。matplotlib 为可选依赖——规格校验与布局推断不依赖它,可独立运行,仅出图需要。
## 安装与使用
```bash
pip install matplotlib # 出图所需(可选)
python scripts/figforge.py --demo --output demo.png
python scripts/figforge.py --spec figure.json --output fig1.png
python scripts/figforge.py --spec figure.json --check-only # 仅校验,无需 matplotlib
```
## 目录结构
```
figforge/
├── SKILL.md
├── scripts/figforge.py
├── references/ figure-spec.md + journal-style.md
├── examples/ 真实多面板图 + 规格示例
├── tests/test_figforge.py13 用例)
├── requirements.txt
└── LICENSE
```
## 真实验证
`--demo` 生成四面板组合图(柱状带误差棒 / 双序列折线 / 散点 / 箱线),中文无乱码,面板标号 (a)(b)(c)(d) 规范去顶右脊线300 DPI PNG136 KB。产物见 [`examples/demo.png`](examples/)。
```bash
python -m pytest tests/ -q # 13 passed
```
## 许可证
[Mulan PSL v2](LICENSE)。