[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-83976":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":9,"pushedAt":9,"updatedAt":25,"readmeContent":26,"aiSummary":9,"trendingCount":15,"starSnapshotCount":15,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},83976,"scipilot-figure-skill","Haojae\u002Fscipilot-figure-skill","Haojae","SciPilot Skills family - Publication-grade scientific figure copilot for Claude Code ",null,"Python",195,6,57,1,0,32,116,180,92.54,"MIT License",false,"main",true,[],"2026-06-12 04:01:42","# scipilot-figure-skill\n\n> SciPilot Skills family. Scientific data **visualization advisor** — thinks first, plots second.\n> SciPilot Skills 家族成员 — 科研数据**可视化顾问**，先思考后绘制。\n\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue.svg)](LICENSE)\n[![Python: 3.9+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPython-3.9%2B-3776AB.svg)](#dependencies--依赖)\n[![Status: v2.1.0](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FStatus-v2.1.0-success.svg)](#)\n[![Advisor Mode](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FMode-Advisor%2BPlotter-c41e3a.svg)](#为什么这不只是个画图工具)\n[![Stack](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FStack-matplotlib%20%7C%20seaborn%20%7C%20plotly-orange.svg)](#)\n[![Claude Code Skill](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FClaude%20Code-Skill-orange.svg)](https:\u002F\u002Fclaude.com\u002Fclaude-code)\n\nA [Claude Code](https:\u002F\u002Fclaude.com\u002Fclaude-code) \u002F [Codex](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fcodex) \u002F Cursor Skill that does **two things in order**: (1) profiles your data and recommends the right chart for the argument you want to make, (2) renders it at publication grade for Nature \u002F Science \u002F IEEE \u002F Elsevier \u002F PNAS \u002F Chinese journals. Built on **matplotlib + seaborn + SciencePlots** (static) and **plotly** (interactive), with **CJK font auto-configuration** so Chinese text never renders as boxes.\n\n> [中文文档](#中文文档) | [English](#english)\n\n---\n\n## 中文文档\n\n### 概览\n\n科研工作者最大的画图痛点往往不是\"不会用 matplotlib\"，而是\"手上一堆数据，不知道该用什么图把结论讲清楚\"。`scipilot-figure-skill` 是 SciPilot Skills 家族的第二个成员，专做这件事——\n\n**它的首要能力是【思考与判断】，其次才是【绘制】。**\n\n### 为什么这不只是个画图工具\n\n```\n普通画图工具           scipilot-figure-skill\n─────────────         ─────────────────────\n你说 \"画柱状图\"  →   先 EDA：每列类型、样本量、分布、异常值、相关性\n直接 plt.bar()        再问：\"你想论证什么？组间差异？关系？趋势？\"\n                     按数据特征 + 论证目标查决策框架推荐图型\n                     n=5 想画均值柱时主动拦截 → 改用 stripplot\n                     维度 > 12 时建议拆图，不硬塞\n                     最后才进入绘制 → 期刊规范 → 自检 → 导出\n```\n\n### 核心工作流（8 步）\n\n```\n0. 理解任务   ── 这张图要论证什么？数据在哪？\n   ↓\n1. 剖析数据   ── profile_data.py：列类型\u002F样本量\u002F分布\u002F异常\u002F相关\n   ↓\n2. 选图       ── chart_selection.md：按数据形态+论证目标决策\n   ↓ (主动拦截 → viz_pitfalls.md)\n3. 查规范     ── journal_specs.md：栏宽\u002F字号\u002FDPI\u002F字体\n   ↓\n4. 配环境     ── setup_style.py：期刊预设+CJK字体\n   ↓\n5. 绘制       ── plot_recipes.md：9 类图配方\n   ↓\n6. 自检闭环   ── 程序自检 visual_qa + AI 读图 visual_review.md（缺字\u002F裁切\u002F重叠\u002F对齐→回改）\n   ↓\n7. 导出       ── export_figure.py：多格式+按最终尺寸+灰度预览\n```\n\n### v2.1 新增：出图后的视觉自检闭环\n\n普通画图工具画完就结束——没人回看成图，于是中文方框、文字被裁、图例压数据、子图编号乱放，全留到投稿才暴露。v2.1 补上**出图后的闭环**：\n\n```\n绘制 → 渲染 PNG → 程序自检(缺字\u002F裁切\u002F重叠) + AI 读图(遮盖\u002F子图对齐\u002F灰度)\n                            ↓ 发现问题\n        回到对应步骤改图 → 重渲 → 再读，直到通过\n```\n\n- **程序抓确定性问题**：`visual_qa.audit_layout()` 同时盯 warning + logging 两条通道拦截缺字乱码，并查文字越界裁切、刻度标签重叠。\n- **AI 读图抓感知性问题**：渲成 PNG 后用多模态读图能力核对图例是否压数据、子图 a\u002Fb\u002Fc 是否对齐、配色灰度可分——这些程序查不出。\n- **子图标签一行对齐**：`layout_tools.add_panel_labels(fig)` 用统一 figure 坐标让 a\u002Fb\u002Fc\u002Fd 横竖成线，不再手摆易错位。\n- **字体兜底**：`setup_style` 全模式默认修负号方框 + 自动配 CJK 字体，从源头少出乱码。\n\n详见 [`references\u002Fvisual_review.md`](references\u002Fvisual_review.md)。\n\n### 五条硬性原则\n\n1. **按最终尺寸出图不二次缩放** — `figsize=(3.5, 2.625)` 直接定 Nature 单栏\n2. **矢量优先** — 数据图走 PDF \u002F SVG \u002F EPS；照片才用 TIFF\u002FPNG；**绝不 JPEG**\n3. **配色对色盲友好** — 默认 Okabe-Ito，加冗余编码，出图前查灰度\n4. **字号在最终尺寸下可读** — 7-9 pt，最小 6 pt\n5. **误差必有交代** — 图注必须写清 SD\u002FSEM\u002F95%CI + n + 检验方法\n\n### 主动拦截的画图错误（精选）\n\n完整 15 条在 [`references\u002Fviz_pitfalls.md`](references\u002Fviz_pitfalls.md)。\n\n- **P1**：n\u003C10\u002F组的均值柱掩盖分布 → 改箱线 + stripplot\n- **P2**：双 Y 轴的\"相关\"是作图者捏造的 → 拆子图或标准化\n- **P3**：饼图与 3D 图 → 横向柱状\n- **P4**：Y 轴不当截断 → 从 0 起或断裂明示\n- **P6**：x 是分类用折线连均值 → 散点 \u002F 柱状\n- **P14**：rainbow \u002F jet 色图 → viridis \u002F RdBu_r\n- **P12**：一图多论点 → 拆图，一图一结论\n- **P16**：中文\u002F负号变方框 → setup_style 配 CJK + 关 unicode_minus，导出前 visual_qa 拦截\n- **P18**：子图 a\u002Fb\u002Fc 乱放 → add_panel_labels 统一对齐\n\n### 安装\n\n```\n请帮我安装这个 Skill：https:\u002F\u002Fgithub.com\u002FHaojae\u002Fscipilot-figure-skill.git\n```\n\n或手动：\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FHaojae\u002Fscipilot-figure-skill.git \\\n          ~\u002F.claude\u002Fskills\u002Fscipilot-figure-skill\npip install -r ~\u002F.claude\u002Fskills\u002Fscipilot-figure-skill\u002Frequirements.txt\n```\n\n`SciencePlots` \u002F `pypdf` \u002F `kaleido` 是可选增强，缺失时不影响运行。\n\n### 中文支持\n\n`setup_style(lang='zh')` 按优先级查找：\n\n```\nNoto Sans CJK SC > Source Han Sans SC > SimHei > Microsoft YaHei\n```\n\n找不到任何 CJK 字体时抛出清晰的安装提示。中文期刊\"宋体 + Times New Roman 数字\"混排：传 `serif_for_zh=True`。\n\n### 使用示例（4 个，**至少 2 个体现\"思考\"**）\n\n**例 1：用户只丢一个 CSV**\n\n```\n我有这份 results.csv，帮我画成论文图。\n```\n\n→ Skill 不会直接画。会先：\n1. 问\"你这份数据主要想说服读者相信什么？\"\n2. 跑 `profile_data.py` 输出剖析报告\n3. 给出推荐图型 + 理由 + 备选\n4. 用户确认后才进入绘制流程\n\n**例 2：用户指定的图型不合适**\n\n```\n帮我画 3 组各 5 个样本的均值柱状图。\n```\n\n→ Skill 主动拦截：\n\n> n=5 太小，均值柱掩盖分布——审稿人很可能要求\"show individual points\"。\n> 我建议改成 **箱线 + stripplot 叠加每个点**：5 个点直接可见。要按原方案画，还是改？\n\n**例 3：多面板组合**\n\n```\n给我画 Figure 1：4 panel，分别是 PCA、loss、混淆矩阵、生存曲线。\nNature 双栏。\n```\n\n→ 各 panel 字号配色统一，子图标签 a\u002Fb\u002Fc\u002Fd 加粗左上，导出 PDF + 灰度预览。\n\n**例 4：带显著性标注**\n\n```\n3 组数据画箱线 + 显著性。\n```\n\n→ 先确认 n、检验方法、是否多重校正；图注必须写清统计内容。\n\n### 命令行直接调脚本\n\n```bash\n# 数据剖析（思考的起点）\npython scripts\u002Fprofile_data.py results.csv --group group --group condition\n\n# 列可用 CJK 字体\npython scripts\u002Fsetup_style.py --list-fonts\n\n# 演示导出\npython scripts\u002Fexport_figure.py demo --out .\u002Ftest_demo\n\n# 合规自检\npython scripts\u002Fcheck_figure.py figs\u002F*.pdf --min-dpi 300 --strict\n```\n\n### SciPilot Skills 家族\n\n| Skill | 状态 | 功能 |\n|---|---|---|\n| scipilot-cite-skill | [v1.0.0](https:\u002F\u002Fgithub.com\u002FHaojae\u002Fscipilot-cite-skill) | 文献检索与引用插入 |\n| **scipilot-figure-skill** | **v2.1.0 (本仓库)** | **可视化顾问 + 绘制 + 视觉自检闭环** |\n| scipilot-polish-skill | 规划中 | 学术论文润色 |\n| scipilot-review-skill | 规划中 | AI 模拟审稿 |\n| scipilot-submit-skill | 规划中 | 投稿格式适配 |\n| scipilot-read-skill | 规划中 | 论文阅读与翻译 |\n\n### 许可证\n\n[MIT](LICENSE) © 2026 Haojae\n\n---\n\n## English\n\n### Overview\n\nThe hardest part of scientific plotting is rarely \"I don't know matplotlib\" — it's \"I have data, I don't know which chart conveys my conclusion.\" `scipilot-figure-skill` is the second member of the SciPilot Skills family, built around this insight: **think first, plot second**.\n\n### Why this isn't just a plotting tool\n\n```\nGeneric plotter            scipilot-figure-skill\n──────────────             ──────────────────────\n\"plot a bar chart\"  →    Profiles data first: types, n, distribution, outliers\nplt.bar()                Asks: \"What argument do you want this figure to make?\"\n                         Decides chart type from data shape + intent\n                         Refuses bad choices (n=5 mean bar → stripplot instead)\n                         Suggests splitting figures when dimensions exceed 12\n                         Only then renders → spec → audit → export\n```\n\n### 8-step core workflow\n\n```\n0. Understand   — what does this figure argue? where is the data?\n   ↓\n1. Profile      — profile_data.py: types \u002F n \u002F distribution \u002F outliers \u002F corr\n   ↓\n2. Select       — chart_selection.md: decision framework by shape + intent\n   ↓ (active interception → viz_pitfalls.md)\n3. Spec         — journal_specs.md: column width \u002F font \u002F DPI\n   ↓\n4. Style        — setup_style.py: journal preset + CJK font config\n   ↓\n5. Plot         — plot_recipes.md: 9 recipe families\n   ↓\n6. Self-check   — visual_qa (program) + AI reads the PNG (visual_review.md): glyphs\u002Fclipping\u002Foverlap\u002Falignment\n   ↓\n7. Export       — export_figure.py: multi-format + final size + grayscale\n```\n\n### New in v2.1: a post-render visual self-check loop\n\nGeneric plotters stop at \"saved\" — nobody looks at the result, so CJK tofu boxes, clipped labels, legends covering data, and misaligned panel letters all survive to submission. v2.1 closes the loop **after rendering**:\n\n```\nplot → render PNG → program audit (glyphs\u002Fclipping\u002Foverlap) + AI reads image (occlusion\u002Fpanel alignment\u002Fgrayscale)\n                              ↓ issues found\n       go back, fix, re-render, re-read — until clean\n```\n\n- **Program catches deterministic issues**: `visual_qa.audit_layout()` traps missing-glyph warnings (both warnings and logging channels), text clipped off-canvas, and overlapping tick labels.\n- **AI catches perceptual issues**: after rasterizing to PNG, the skill reads the image to check whether the legend covers data, whether panel letters a\u002Fb\u002Fc line up, and whether colors stay distinct in grayscale.\n- **One-call panel alignment**: `layout_tools.add_panel_labels(fig)` places a\u002Fb\u002Fc\u002Fd in unified figure coordinates so they align both ways.\n- **Font safety net**: `setup_style` fixes the minus-sign box in all modes and auto-configures CJK fonts.\n\nSee [`references\u002Fvisual_review.md`](references\u002Fvisual_review.md).\n\n### Five hard rules\n\n1. **Render at final size, never rescale** — set `figsize=(3.5, 2.625)` directly\n2. **Vectors first** — PDF \u002F SVG \u002F EPS for data figures; **never JPEG**\n3. **Colorblind-safe palette** — Okabe-Ito default + redundant encoding\n4. **Readable type at final size** — 7-9 pt body, 6 pt minimum\n5. **Errors must be explained** — captions state SD\u002FSEM\u002FCI + n + test type\n\n### Actively intercepted mistakes\n\nFull 15 in [`references\u002Fviz_pitfalls.md`](references\u002Fviz_pitfalls.md).\n\n- **P1**: mean-only bar charts with n\u003C10 hide distributions → use box + stripplot\n- **P2**: dual-Y axis fabricates correlations → split panels or standardize\n- **P3**: pie charts and 3D bars → horizontal bar\n- **P14**: rainbow \u002F jet colormaps → viridis \u002F RdBu_r\n- **P12**: one figure with five points → split, one figure per claim\n- **P16**: CJK \u002F minus-sign tofu boxes → setup_style configures CJK + disables unicode_minus; visual_qa blocks leftover missing glyphs\n- **P18**: scattered panel letters → add_panel_labels aligns a\u002Fb\u002Fc in one call\n\n### Installation\n\n```\nPlease install this Skill for me: https:\u002F\u002Fgithub.com\u002FHaojae\u002Fscipilot-figure-skill.git\n```\n\nManual:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FHaojae\u002Fscipilot-figure-skill.git \\\n          ~\u002F.claude\u002Fskills\u002Fscipilot-figure-skill\npip install -r ~\u002F.claude\u002Fskills\u002Fscipilot-figure-skill\u002Frequirements.txt\n```\n\n### Usage examples\n\n**Example 1: bare CSV**\n\n```\nI have results.csv. Plot it for my paper.\n```\n\nThe skill will: profile the data, ask what argument the figure should make, recommend a chart with rationale + alternatives, and only then plot.\n\n**Example 2: bad request, gentle refusal**\n\n```\nPlot a bar chart of group means: 3 groups, 5 samples each.\n```\n\nThe skill will reply:\n\n> With n=5 per group a mean bar chart hides the distribution and reviewers\n> typically ask for individual data points. I recommend **box plot +\n> stripplot overlay** — all five points are visible and the distribution\n> is clear. Stick with bars, or switch?\n\n**Example 3: multi-panel composite**\n\n```\nFigure 1, 4 panels: PCA, loss curves, confusion matrix, survival.\nNature double column.\n```\n\n**Example 4: statistical comparison**\n\n```\n3 groups, box plot with significance.\n```\n\n### SciPilot Skills family\n\n| Skill | Status | Purpose |\n|---|---|---|\n| scipilot-cite-skill | [v1.0.0](https:\u002F\u002Fgithub.com\u002FHaojae\u002Fscipilot-cite-skill) | Reference discovery & insertion |\n| **scipilot-figure-skill** | **v2.1.0 (this repo)** | **Advisor + renderer + visual self-check loop** |\n| scipilot-polish-skill | Planned | Academic prose polishing |\n| scipilot-review-skill | Planned | AI peer-review simulation |\n| scipilot-submit-skill | Planned | Submission formatting |\n| scipilot-read-skill | Planned | Paper reading & translation |\n\n### License\n\n[MIT](LICENSE) © 2026 Haojae\n\n### Dependencies \u002F 依赖\n\n```\nmatplotlib>=3.7\nseaborn>=0.13\nplotly>=5.18\npandas>=2.0\nnumpy>=1.24\nscipy>=1.10\nPillow>=10.0\nSciencePlots>=2.1   # optional\npypdf>=4.0          # optional\nkaleido>=0.2.1      # optional\nPyMuPDF>=1.23       # optional; only for visual_qa.render_preview() of saved PDFs\n```\n\nPython 3.9+ recommended.\n",2,"2026-06-11 04:11:57","CREATED_QUERY"]