Skip to content
Back to search

academic-figure-skill

A skill for academic research figure generation that autonomously handles the full workflow — data understanding, chart type recommendation, and format-compliant generation.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/tingxiyu--academic-figure-skill/badge.svg)](/listings/tingxiyu--academic-figure-skill)

HTML

<a href="/listings/tingxiyu--academic-figure-skill"><img src="/api/listings/tingxiyu--academic-figure-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 525 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ---
  2. name: academic-figure-skill
  3. description: Academic-grade scientific figure creation for Nature/Cell/Science journals. Use when the user asks to create, polish, review, or export scientific figures for manuscript submission. DO NOT trigger for: interactive dashboards (Plotly/Bokeh/Altair), exploratory data analysis without publication intent, math function plots, pie/3D charts, PowerPoint slides, or Illustrator/Figma-first design. SKIP requests about statistical testing, data cleaning, literature review, or code debugging — these are not figure-making tasks.
  4. ---
  5. # Academic Figure Skill Hub
  6. Academic Figure Skill generates publication-grade scientific figures for Nature/Cell/Science family journals. Every figure starts from the scientific question, not from a template.
  7. ## Design Principles
  8. **1. One figure, one core message.**
  9. CNS reviewers skim fast. A figure must convey its main conclusion in 3 seconds. Remove gridlines, borders, and legend entries that dilute the core message. Default to minimal, not maximal.
  10. **2. Restrained color > abundant color.**
  11. Default palettes (matplotlib tab10, ggplot2 hue_pal, Excel colors) signal "not designed" instantly. Use 2-4 semantic main colors + 1 accent. See `references/color-palettes.md`.
  12. **3. Design for print, not screen.**
  13. Journal column widths are fixed (89 mm single, 183 mm double). Set figure dimensions at creation time — never scale down post-render.
  14. **4. Vector first, raster as fallback.**
  15. Line art, scatter plots, bar charts → PDF/SVG/EPS. Only true raster content (heatmap color blocks, micrographs) should use TIFF/PNG at ≥300 dpi.
  16. ---
  17. ## Complete Workflow
  18. Follow this closed loop for every request. Never skip steps. Never assume the user's question.
  19. ```
  20. User request received
  21. │
  22. ▼
  23. Step -1: Understand the Task ←── DISPATCH FIRST. If the user gave data but
  24. │ didn't say what they want to learn, ASK.
  25. ▼
  26. Step 0: Parse Data, Match to Task ←── Data parsing is directed by the
  27. │ question, not by a template.
  28. ▼
  29. Step 1: Recommend & Justify ←── "To answer your question, you need these
  30. │ N panels. Here's why." N depends on the
  31. ▼ question, not on a fixed number.
  32. User Confirms ──→ No → Refine recommendation
  33. │
  34. ▼ Yes
  35. Step 2: Runtime & Environment ←── Detect Python + R availability.
  36. │ Install or configure if missing.
  37. ▼
  38. Step 3: Style Baseline Injection ←── typography + color + export blocks.
  39. │ Copied VERBATIM into every script.
  40. ▼
  41. Step 4: Production Asset Scan ←── ls assets/figures/. For EVERY panel in
  42. │ the plan, check matching scripts.
  43. ▼
  44. Step 5: Generate ←── COPY-FIRST for matching scripts → native run.
  45. │ No match → cross-type inherit.
  46. ▼
  47. Step 5.5: Validate Data ←── Data sanity checks BEFORE rendering.
  48. │
  49. ▼
  50. Step 6: QA Protocol ←── 4-pass QA (AP-0..AP-7, CL-1..CL-7,
  51. │ VI-1..VI-6, VV-1..VV-5). Fix → re-render.
  52. ▼
  53. Step 7: Deliver ←── Vector PDF master + 300dpi PNG preview
  54. + QA report + statistics report
  55. ```
  56. ---
  57. ### Step -1: Understand the Task — DISPATCH FIRST
  58. **Before reading a single data file, understand what the user is trying to learn.** A dataset without a question is a spreadsheet, not a figure. The entire visualization plan flows from this question.
  59. Classify the request into one of:
  60. | User intent | Signal | Example |
  61. |-----------|--------|---------|
  62. | **User specified figure types** | "Make a volcano plot" / "画个热图" | User knows what they want. Proceed to Step 1 with the specified types. |
  63. | **User has a question + data** | "Does Treatment affect Pheno1?" / "What drives Group differences?" | User has a scientific question. Proceed to Step 0. |
  64. | **User gave data, no question** | "Analyze this data" / "Visualize this" / "看看这个数据" | **STOP. Ask the user: "What are you trying to learn from this data? Are you comparing groups? Looking for correlations? Finding outliers? Testing a hypothesis?"** Do NOT proceed until the user clarifies. Never generate generic "analysis" without a question. |
  65. | **Cosmetic fix** | "Change this bar to blue" / "调整字号" | Skip to Steps 4-6. No contract needed. |
  66. **If the user gave data without a question, the default response is a question, not a figure.**
  67. ---
  68. ### Step 0: Classify & Parse
  69. **Step 0a — Classify the figure archetype FIRST.** Before parsing data, classify the figure into one of four archetypes. This determines layout strategy.
  70. | Archetype | Description | Layout Strategy |
  71. |-----------|------------|----------------|
  72. | `quantitative_grid` | All panels carry equal scientific weight. Standard grid of related data plots. | **Symmetric.** No hero panel. Equal panel sizes. |
  73. | `schematic-led` | A schematic/model diagram anchors the figure, supported by data panels. | **Asymmetric.** The schematic IS the hero. Data panels are supporting. |
  74. | `image_plate + quant` | Microscopy/images paired with quantitative analysis. | **Asymmetric.** The image plate IS the hero. Quant panels are supporting. |
  75. | `asymmetric_mixed` | Panels have different information density. One dense overview (heatmap/PCA/UMAP) dominates. | **Asymmetric.** The densest panel IS the hero. |
  76. **If unsure, default to `asymmetric_mixed`** — it produces the Nature-style look of one dominant panel + subordinate evidence panels. Pure symmetric grids are rare in top-tier journals outside of supplement.
  77. Pass the archetype to `compose_figure(archetype=...)`. The engine auto-detects which panel is the hero and applies asymmetric layout when the archetype is not `quantitative_grid` or `symmetric`.
  78. **Step 0b — Parse data.** Once the archetype is classified, read and analyze the data — but only the aspects relevant to the question.
  79. 1. **Parse structure:** Load the data. Count rows, columns. Classify each column (continuous / categorical / group label / identifier).
  80. **DATA INTEGRITY RULE — NON-NEGOTIABLE:**
  81. - **Use ALL user-provided data.** Never downsample, never select "representative" rows, never pick "a few columns to keep it simple", never `np.random.choice(df, 12)` when the user gave 1200 rows. The user's data IS the ground truth. Reducing it is fabricating evidence.
  82. - **If rendering performance is a concern** (e.g. scatter plot with >50K points), use `rasterized=True` or vector-friendly density representations. Never subsample to solve a rendering problem.
  83. - **If a production script expects a different data shape** than the user provided (e.g. script needs `real_value.csv + pred_value.csv` but user has `Pheno1-Pheno8`), do NOT silently adapt by picking two columns. Inform the user: "This script expects paired X/Y data. Your data has N columns. Which two should I use as X and Y?" Wait for confirmation before proceeding.
  84. - **If you drop any rows or columns for ANY reason**, state exactly how many were dropped, why, and get user acknowledgment in the QA report. Silent data loss is the #2 most serious bug in this skill.
  85. 2. **Run question-directed analysis:** The question determines what to compute.
  86. - "Does X differ between groups?" → Compute group means, between/within variance, pairwise tests
  87. - "What drives Y?" → Compute correlation matrix, PCA, feature importance
  88. - "Are these two variables related?" → Compute correlation, fit line, check residuals
  89. - "What's the distribution?" → Compute summary stats, test normality, detect outliers
  90. 3. **Do NOT run generic analysis.** If the question is about group differences, don't report the full correlation matrix. If the question is about correlation, don't compute group means for every possible partition. Data parsing serves the question, not the other way around.
  91. ---
  92. ### Step 1: Recommend Figures & Justify
  93. Based on the question and the data morphology, propose a visualization plan. For each panel, state:
  94. 1. **What question does this panel answer?** — One sentence per panel.
  95. 2. **Why this figure type?** — Justify the choice based on data characteristics, not habit.
  96. 3. **How many panels?** — Determined by the number of distinct questions, not by a template. Two questions → two panels. Six questions → six panels. No filler panels.
  97. The recommendation must follow this structure:
  98. ```
  99. Visualization Plan
  100. Scientific goal: [one sentence — what the user wants to learn]
  101. | Panel | Figure type | Answers | Data basis |
  102. |-------|------------|---------|------------|
  103. | (a) | [type] | [question] | [e.g. Pheno1-6 all r>0.9 → heatmap] |
  104. | (b) | [type] | [question] | [e.g. PC1=92% → PCA with group coloring] |
  105. | ... | ... | ... | ... |
  106. Total: N panels. Layout: [M×N]. Journal: [target].
  107. ```
  108. **Re-evaluate after user feedback.** If the user says "also show X" or "don't need Y", update the plan and re-present. Only proceed after explicit confirmation.
  109. ---
  110. ### Step 2: Runtime & Environment
  111. After the plan is confirmed, before generating any code, verify the execution environment.
  112. 1. **Detect available runtimes:**
  113. ```bash
  114. python --version 2>/dev/null || python3 --version 2>/dev/null
  115. Rscript --version 2>/dev/null || ls "/c/Program Files/R/"*/bin/Rscript.exe 2>/dev/null
  116. ```
  117. Store as `PYTHON_AVAILABLE`, `R_AVAILABLE`, `R_PATH`.
  118. 2. **Match runtimes to the plan:** For each panel in the confirmed plan:
  119. - If a production script exists (will be checked in Step 3) → the script's language must have a runtime
  120. - If no production script exists → generate in Python (default) or R (user preference)
  121. 3. **Handle missing runtimes:**
  122. - R panel requested but R not found → Tell user: "Panel (c) needs R with ComplexHeatmap. Install R or I'll use Python fallback (lower quality)."
  123. - Python panel requested but Python not found → Tell user: "Python not found. Install Python 3.9+."
  124. - Missing R packages → `install.packages(...)` command provided
  125. - Missing Python packages → `pip install ...` command provided
  126. **Do not silently fall back.** The user decides whether to install the missing runtime or accept lower quality.
  127. ---
  128. ### Step 3: Style Baseline Injection (ALWAYS FIRST)
  129. Load these three files and copy their "COPY VERBATIM" code blocks into the script — in order, at the very top, before any panel logic:
  130. 1. `references/typography.md` — rcParams/theme block. Fonts, spines, ticks, legend defaults.
  131. 2. `references/color-palettes.md` — PALETTE constants. All color variables.
  132. 3. `references/export-specs.md` — font embedding + save function.
  133. Also read `references/journal-specs.md` for target dimensions (89mm single / 183mm double).
  134. ---
  135. ### Step 4: Production Asset Scan (EVERY panel)
  136. **Run AFTER plan confirmation, BEFORE code generation. For EVERY panel in the confirmed plan:**
  137. 1. **First, read `references/directory-map.md`.** This table maps user language (Chinese + English) to exact `assets/figures/<dir>/` paths. Find the user's description in the "Keywords" column → use the exact directory path. This prevents the #2 recurring bug: "柱状图" matching the wrong bar sub-directory.
  138. 2. Verify with `ls assets/figures/<matched-dir>/` that the directory exists and has scripts.
  139. 3. Check the matching directory for production scripts (`.py`, `.R`, `.r`).
  140. 4. For each match, check if the script's language runtime is available (from Step 2).
  141. 5. **Verify script can work with user data.** Read the script. Identify the script's "data entry points" — which variables receive external data (column names, data frames, file paths). Map them to the user's data columns. If the mapping exists but columns differ (e.g. script expects `length`/`number_of_cds` but user has `Pheno1`/`Pheno2`), mark as "visual adapt" — the script's visual system is preserved, only data mapping changes. Only mark as "incompatible" when the data STRUCTURE fundamentally differs (e.g. script expects paired X/Y CSV files but user has a single wide table).
  142. 6. **Fallback:** Only if `directory-map.md` has no matching entry, fall back to scanning `ls assets/figures/` and matching directory names.
  143. Decision per panel:
  144. ```
  145. Panel type matched in assets/figures/<type>/
  146. │
  147. ├── Script exists + runtime available + data STRUCTURE matches → COPY-FIRST.
  148. │ 1. Copy the ENTIRE script file to work_dir/<panel>_production.<ext>
  149. │ 2. Find the data-loading line, replace ONLY the data path
  150. │ 3. Execute: subprocess.run([python/r_bin, script])
  151. │ 4. If FAIL: log reason → downgrade to VISUAL ADAPT with notice
  152. │ 5. If OK: load rendered PNG via Image.open() in composition
  153. │ Panel quality = PRODUCTION. NEVER write a drawing function for this panel.
  154. │
  155. ├── Script exists + data COLUMNS differ but STRUCTURE matches → VISUAL ADAPT (NEW).
  156. │ The script's visual system (layout, coords, colormap, annotations, inset
  157. │ positioning, statistical overlays) is PRESERVED. Only the data mapping changes.
  158. │
  159. │ VISUAL ADAPT protocol — PRESERVES production script's visual system:
  160. │
  161. │ **Step 0: SEMANTIC MATCH CHECK (NEW — run BEFORE column mapping).**
  162. │ Open the production script's companion PNG. Answer:
  163. │ - What does this script actually PRODUCE? (scatter with marginal density?
  164. │ grouped KDE? 2D kernel density contour? ridgeplot? violin?)
  165. │ - What does the USER want? (from their request: "边际密度图", "核密度图",
  166. │ "分布图", "density", "KDE", etc.)
  167. │ - Are they semantically compatible? (1D vs 1D? 2D vs 2D? same number of
  168. │ data dimensions?)
  169. │
  170. │ **If YES → Proceed to Step 1 (column mapping).**
  171. │ The script produces what the user wants. Column names differ but the
  172. │ visual system (layout, axes, transformations) can be preserved.
  173. │
  174. │ **If NO → STOP. Do not VISUAL ADAPT.**
  175. │ Column mapping cannot fix a semantic mismatch. A JointGrid 2D scatter
  176. │ script cannot produce a 1D marginal density plot no matter how you map
  177. │ columns. Two cases:
  178. │ - User wants 1D density of multiple variables → cross-type inherit from
  179. │ Ridge (density fill + bandwidth) or KDE/Density (distribution pattern)
  180. │ - User wants 2D scatter density → find a semantically matching 2D script
  181. │
  182. │ 1. Identify the script's data entry points:
  183. │ - What column names does it reference? (e.g. "length", "number_of_cds")
  184. │ - What grouping variable? (e.g. "type", "Group")
  185. │ - What filtering columns? (e.g. "is_drep95")
  186. │ 2. Map to user's data:
  187. │ - Script column X → User column ____ (choose most semantically similar)
  188. │ - Script column Y → User column ____
  189. │ - Script grouping col → User column ____ (or None if user has no groups)
  190. │ 3. PRESENT THE MAPPING TO THE USER for confirmation.
  191. │ 4. **Data range compatibility check (NEW):** Before copying the script, verify
  192. │ that the user's data values are compatible with the script's mathematical
  193. │ operations. Specifically check:
  194. │ - Does the script use log-scale axes? → User data must have NO values ≤ 0
  195. │ - Does the script normalize to [0,1]? → User data must have finite range
  196. │ - Does the script use sqrt/division? → User data must be non-negative
  197. │ - Does the script bin continuous data? → User data must have sufficient range
  198. │
  199. │ If ANY check fails, identify which visual elements must be adapted:
  200. │ - Log scale with negative values → drop log transform, keep linear axes
  201. │ - Normalization with zero range → skip normalization, use raw values
  202. │ - Division by zero risk → add epsilon guard
  203. │ Tell the user which transforms were dropped and why.
  204. │ 5. Copy the script. Modify ONLY:
  205. │ - Column name references (search-replace old col name → user col name)
  206. │ - Grouping column mapping (or set group=None if none)
  207. │ - Mathematical transforms that conflict with data range (from step 4)
  208. │ - Data path
  209. │ - NEVER modify: layout structure, color palettes, annotation logic,
  210. │ figure dimensions, export parameters
  211. │ 6. Execute the adapted script. Verify output PNG renders.
  212. │ 7. If execution fails: log reason → downgrade to PARAM INHERIT with notice
  213. │ Panel quality = PRODUCTION VISUAL SYSTEM. The layout and aesthetics are
  214. │ from the production script; only the data source changed.
  215. │
  216. ├── Script exists + data STRUCTURE incompatible → CROSS-TYPE INHERIT + INFORM.
  217. │ Tell user: "[dir] has scripts but fundamentally different data structure.
  218. │ Using cross-type inheritance. Visual quality will be lower."
  219. │
  220. ├── Script exists + runtime NOT available → EXTRACT PARAMETERS.
  221. │ Read the script's FULL content. Open its companion PNG.
  222. │ Extract Class A/B/C parameters. Cross-type inherit.
  223. │ Inform user of the quality tradeoff.
  224. │
  225. └── No script exists → CROSS-TYPE INHERIT.
  226. Borrow from similar figure type in the borrowing table below.
  227. ```
  228. **Borrowing table (no matching script):**
  229. ```
  230. Requested type Borrow from What transfers
  231. ─────────────────────────────────────────────────────
  232. RDA PCA scatter point size, alpha, ellipse style
  233. Radar Bar color palette ratio, legend style
  234. KDE / Density Ridge alpha fill, line color, bandwidth factor
  235. UpSet Confusion Matrix fill color, edge color, font size
  236. Single-cell traj. PCA scatter point size, alpha, colormap
  237. Forest Bar line width, marker size, color logic
  238. Sankey (use own if exists) node color palette, flow alpha
  239. Heatmap CorrHeatmap colormap, colorbar settings
  240. Correlation Scatter Scatter (basic) point size, alpha, regression line style
  241. ```
  242. #### Class A/B/C parameter extraction
  243. **Class A — Hard Parameters (copy verbatim):** Color hex, alpha, line widths, marker sizes, bandwidth, density scale, spacing ratios.
  244. **Class B — Scaling Parameters (preserve ratio):** Font sizes → scale proportionally to Academic Figure Skill 7pt base. Figure dimensions → scale to journal column width.
  245. **Class C — Logic Parameters (copy behavior):** Legend on/off, grid on/off, spine visibility, statistical annotation format, frameon.
  246. #### Preview PNG — HARD RULE
  247. **You MUST open the companion PNG before finalizing parameters.** Find the PNG with the same basename as the script. Inspect it. Ask: *Do my extracted parameters reproduce this visual output?* If uncertain → re-read the script.
  248. ---
  249. ### Step 5: Generate Code
  250. **Asset Confirmation Table — MUST be the first lines of the generated script.**
  251. Before any import, before any baseline block, the generated script MUST start with this exact comment block:
  252. ```python
  253. # Academic Figure Skill Asset Confirmation (verified against assets/figures/)
  254. # (a) [figure type] → [asset path or "cross-type inherit"] → [native run | param inherit]
  255. # (b) [figure type] → [asset path or "cross-type inherit"] → [native run | param inherit]
  256. # ...
  257. # RULE: "native run" = load pre-rendered PNG via Image.open().ax.imshow().
  258. # "param inherit" = drawing function below that copies Class A/B/C values.
  259. # If a panel says "native run" and you write a drawing function, you broke the contract.
  260. ```
  261. **COPY-FIRST RULE — this is a MECHANICAL rule, not a judgment call.**
  262. For EVERY panel marked "native run" in the Asset Confirmation Table:
  263. 1. **Copy the production script file to a working file.** Use `shutil.copy()` or shell `cp`. The filename must be `<panel_label>_production.<ext>`.
  264. 2. **Modify ONLY the data path.** Open the copied file, find the line that reads data (`pd.read_csv(...)`, `read.csv(...)`, `read.delim(...)`), and replace the path with the user's data path. Change NOTHING else.
  265. 3. **Execute the copied script.** Python: `subprocess.run([sys.executable, script])`. R: `subprocess.run([r_bin, script])`.
  266. 4. **Verify output.** Check that the output PNG/PDF file exists and is non-zero. If execution fails (syntax error, missing package, data mismatch), log the error, set that panel to "param inherit" in a REVISED Asset Confirmation Table comment, and proceed with cross-type inheritance instead. The failure reason MUST appear in the QA report.
  267. 5. **For R scripts:** ensure `png(type="cairo")` and `showtext_auto(FALSE)` before `png()` per `references/r-rendering.md`.
  268. **What this means in the composition script:**
  269. - "native run" panels → NO drawing function. The script loads the pre-rendered PNG via `Image.open()`.
  270. - "param inherit" panels → drawing function with Class A/B/C values extracted from the named asset.
  271. - If a native run FAILED → REVISED table shows the downgrade to "param inherit" and the reason.
  272. **Forbidden patterns (these indicate the COPY-FIRST rule was violated):**
  273. - A drawing function whose name matches a panel marked "native run" in the table.
  274. - A drawing function that is a "simplified version" of a production script.
  275. - Importing functions from a production script instead of executing the whole script.
  276. Script structure:
  277. ```
  278. 1. Asset Confirmation Table (MANDATORY — the first lines)
  279. 2. Style baseline (verbatim from Step 3) — ONCE at top
  280. 3. Data section — ALL user data loaded here, NEVER downsampled
  281. 4. Production script execution (for "native run" panels) — subprocess calls
  282. 5. Panel functions — PNG loaders for "native run", drawing functions for "param inherit"
  283. 6. compose_figure() call — handles layout, spacing, labels, export
  284. ```
  285. **Mixed Python+R:** R panels run first to PNG at spec-correct dimensions. Python engine loads them via `ax.imshow()`.
  286. **R PNG rendering:** Follow the three mandatory rules in `references/r-rendering.md`. Never skip them — they prevent the #1 recurring R PNG quality bug.
  287. ---
  288. ### Step 5.5: Validate Data Before Rendering
  289. Run chart-type checks on every panel's data array. Fix failures before rendering.
  290. ```
  291. Volcano: (padj < 0.05).sum() ≥ 10 AND ≤ 80%
  292. AUROC: (tpr - fpr).max() ≥ 0.15
  293. Heatmap: np.std(data, axis=1).mean() > 0.2
  294. Bar: abs(means.max() - means.min()) / means.max() > 0.05
  295. Corr: abs(corr_mat).max() (off-diag) ≥ 0.3
  296. PCA/RDA: between_group_var / within_group_var > 1.0
  297. Box/Violin: abs(medians.max() - medians.min()) / data_range > 0.1
  298. ```
  299. Also predict 3 visual problems at the target panel width. Fix them before rendering.
  300. ---
  301. ### Step 6: QA Protocol
  302. Execute the 4-pass QA protocol from `references/checklist.md`.
  303. - **Pass 0:** Anti-pattern scan (AP-0 through AP-7) + revision case cross-reference (VI-7)
  304. - **Pass 1:** Code-level compliance (CL-1 through CL-7)
  305. - **Pass 2:** Visual logic & data integrity (VI-1 through VI-6)
  306. - **Pass 3:** Rendered output verification (VV-1 through VV-5)
  307. QA Gateway: READY (all pass) → Deliver. FIX (≤2) → Fix and re-run. ESCALATE (>2) → Reviewer Simulation Mode.
  308. If Python/R runtime is unavailable, skip Pass 3 and warn the user.
  309. ---
  310. ### Step 7: Deliver
  311. Output:
  312. 1. Complete code block
  313. 2. QA self-check report
  314. 3. Vector PDF master + 300dpi PNG preview
  315. 4. **Statistics & Reproducibility Report** — for every quantitative panel:
  316. - n definition (what does each replicate represent?)
  317. - center statistic (mean? median?)
  318. - spread / interval (SD? SEM? 95% CI? — define which one was used)
  319. - statistical test name
  320. - multiple-comparison correction (if applicable)
  321. - source-data traceability (which file/column produced each data point)
  322. - For ML/model figures: train/validation/test split, number of seeds/folds, metric definition, baseline definition
  323. 5. Suggested next step
  324. **The statistics report is not optional.** A figure without statistical documentation is not a publication-grade figure. Reviewers expect this information and will request it if missing.
  325. ---
  326. ## Reviewer Simulation Mode
  327. If the user asks "will this pass review?":
  328. > Role: You are a reviewer for [journal]. Review through 5 lenses:
  329. > 1. Scientific clarity — main message in 3 seconds?
  330. > 2. Visual hierarchy — most important element draws the eye?
  331. > 3. Color & accessibility — print-safe, colorblind-friendly?
  332. > 4. Typography & labeling — legible at print size?
  333. > 5. Overall polish — anything making you "frown"?
  334. Output: structured feedback with priority (must-fix vs. suggestion) and fix instructions.
  335. ---
  336. ## Anti-Pattern Recognition
  337. Flag these immediately when reviewing user code:
  338. - Default color palettes → offer semantic palette
  339. - Four-sided borders → offer clean left/bottom spine
  340. - Legend inside plot → offer outside/direct labeling
  341. - Screenshot-only export → offer vector PDF
  342. - Jet/rainbow colormap → offer perceptually uniform
  343. - Bar chart without individual points (n < 10) → offer strip/swarm overlay
  344. - Default font → offer Arial/Helvetica
  345. ---
  346. ## Figure Type Routing
  347. All figure types routed through `assets/figures/<type>/`. Adding a new type = adding a directory with scripts. No registration needed.
  348. ## Eval & Quality Tracking
  349. ```bash
  350. # Full asset audit — scripts, syntax, baseline compliance
  351. py academic-figure-skill/scripts/eval_runner.py
  352. py academic-figure-skill/scripts/eval_runner.py --type PCA
  353. # Trigger accuracy benchmark — 40 prompts, F1/precision/recall
  354. py academic-figure-skill/scripts/trigger_benchmark.py
  355. py academic-figure-skill/scripts/trigger_benchmark.py --calibrate
  356. # QA validator coverage — test each check against known-good/bad scripts
  357. py academic-figure-skill/scripts/qa_coverage.py
  358. # Reference integrity — directory-map, PANEL_ASPECT, SKILL.md cross-links
  359. py academic-figure-skill/scripts/check_references.py
  360. py academic-figure-skill/scripts/check_references.py --json
  361. # E2E integration — automated A/B scenario scoring
  362. py academic-figure-skill/scripts/e2e_runner.py
  363. py academic-figure-skill/scripts/e2e_runner.py --scenario S1_pca
  364. ```
  365. ## Cross-Platform Adapters
  366. Generate platform-specific adapter files for non-Claude-Code agents:
  367. ```bash
  368. python academic-figure-skill/scripts/generate_adapters.py # all platforms
  369. python academic-figure-skill/scripts/generate_adapters.py --target cursor # Cursor only
  370. ```
  371. Generated adapters are in `install/`:
  372. - `install/cursor/.cursorrules` → copy to your project root for Cursor
  373. - `install/copilot/copilot-instructions.md` → copy to `.github/` for GitHub Copilot
  374. - `install/codex/manifest.yaml` + `instructions.md` → copy to `~/.codex/skills/academic-figure-skill/` for Codex
  375. - `install/claude-code/README.md` → already supported natively via `~/.claude/skills/`
  376. ---
  377. ## References
  378. ### Always Load
  379. | File | Purpose |
  380. |------|---------|
  381. | `references/figure-contract.md` | Scientific claim, evidence chain, archetype, review risks |
  382. | `references/color-palettes.md` | Color selection |
  383. | `references/typography.md` | Font setup |
  384. | `references/journal-specs.md` | Dimension and spine setup |
  385. | `references/export-specs.md` | Format and resolution |
  386. | `references/checklist.md` | Full QA checklist |
  387. ### On-Demand
  388. | File | When |
  389. |------|------|
  390. | `references/journal-intel.md` | User specifies a target journal |
  391. | `references/common-pitfalls.md` | After code generation |
  392. | `references/revision-cases.md` | Figure type matches known case / "will this pass review" |
  393. | `references/multipanel-layout.md` | Multi-panel figures — anti-redundancy, hero panel, narrative |
  394. | `references/directory-map.md` | Step 4 — maps user language to exact figure directory paths |
  395. | `references/figure-deconstruction.md` | Compositional inspiration |
  396. | `references/matplotlib.md` | Python/matplotlib/seaborn |
  397. | `references/complexheatmap.md` | R heatmaps |
  398. | `references/r-rendering.md` | R PNG output — cairo device, showtext off, spec-correct dimensions |
  399. ### Production Assets
  400. | Path | When |
  401. |------|------|
  402. | `assets/figures/<type>/` | Step 4 — production script scan |
  403. | `assets/figures/other/` | Long-tail fallback |
README.md · README · 352 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <div align="center">
  2. <h1>Academic Figure Skill</h1>
  3. <p><strong>面向学术级科学图表生成Skill,可自动完成从数据解读到顶刊格式图表生成的全流程。</strong></p>
  4. <p>
  5. 问题驱动 · 8 步闭环工作流 · 29 种图型 · 四轮 QA 协议 · 矢量 PDF 交付 · 统计报告
  6. </p>
  7. <p>
  8. <a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-2ea44f"></a>
  9. <a href="#安装与使用"><img alt="Install" src="https://img.shields.io/badge/install-Claude%20Code%20%7C%20Codex%20%7C%20Cursor%20%7C%20Copilot-111827"></a>
  10. <a href="#图表类型全览"><img alt="Figure Types" src="https://img.shields.io/badge/figures-29-0ea5e9"></a>
  11. <a href="#assets-figure-atlas"><img alt="QA" src="https://img.shields.io/badge/QA-4%20pass%2030%2B%20checks-success"></a>
  12. <a href="README_EN.md"><img alt="Language" src="https://img.shields.io/badge/语言-English%20%7C%20中文-1f6feb"></a>
  13. </p>
  14. <p>
  15. <a href="#项目介绍">项目介绍</a>
  16. · <a href="#安装与使用">安装与使用</a>
  17. · <a href="#图表类型全览">图表类型</a>
  18. · <a href="#系统工作流">工作流</a>
  19. · <a href="#项目结构">项目结构</a>
  20. · <a href="#质量评估与测试">质量评估</a>
  21. · <a href="#贡献指南">贡献指南</a>
  22. · <a href="README_EN.md">English</a>
  23. </p>
  24. </div>
  25. ---
  26. **Academic Figure Skill** 以"问题驱动而非模板驱动"为核心原则——每一张图从科学问题出发,通过 8 步闭环工作流(用户意图解析 → 原型分类 → 图型论证 → 环境探测 → 风格注入 → 资产检索 → 渲染生成 → 质量验证),输出可直接投稿的矢量 PDF 主文件 + 300dpi PNG 预览 + 统计报告。更多详情,请关注微信公众号:**科研绘图酱**。
  27. ---
  28. ## 效果预览
  29. <p align="center">
  30. <img src="assets/figure-atlas/preview.png" width="100%" alt="Academic Figure Skill 多面板效果预览">
  31. </p>
  32. <details>
  33. <summary>点击展开更多示例图表</summary>
  34. <p align="center">
  35. <img src="assets/figure-atlas/data-figure.png" width="100%" alt="示例图表2">
  36. </p>
  37. </details>
  38. ---
  39. ## 项目介绍
  40. Academic Figure Skill 是一个面向 AI 编程助手(Claude Code、Codex 等)的 Skill 包。其工作方式是:将 Nature / Cell / Science 系列期刊的图表制作规范(字体 Arial/Helvetica、栏宽 89mm/183mm、PDF 矢量导出、300dpi 栅格预览)和 29 种常见图型的视觉参数编码为 `SKILL.md` 及其引用的 16 份参考文档。当用户提供数据和科学问题后,Skill 引导 LLM 执行一个标准化的 8 步流程:澄清研究问题 → 分类图型原型 → 论证面板方案并获取用户确认 → 检测 Python/R 运行时 → 注入统一的排版和配色基线 → 扫描 `assets/figures/` 中的生产脚本(匹配则原生运行,无匹配则跨类型继承视觉参数)→ 数据校验 → 4 轮 QA 自检 → 输出矢量 PDF 与统计报告。
  41. 该 Skill 不替代 Python 或 R 的绘图能力,而是提供一套结构化的约束条件(constraints)和先验知识(priors),使 LLM 在生成绘图代码时遵循 CNS 期刊的视觉标准,减少人工调整排版、配色和导出参数的工作量。在多面板合成场景中,Skill 支持 Python 脚本和 R 脚本的混合编排——R 面板通过 Cairo 设备渲染为位图,Python 的 `compose.py` 排版引擎按物理尺寸拼合多面板。
  42. ### 设计原则
  43. | 原则 | 说明 |
  44. |------|------|
  45. | **一幅图一个核心信息** | 审稿人 3 秒扫读即懂;移除网格线、边框和无用图例 |
  46. | **克制配色 > 丰富配色** | 2-4 个语义主色 + 1 个强调色;禁用 matplotlib/ggplot 默认色板 |
  47. | **面向印刷设计** | 期刊固定栏宽(单栏 89mm / 双栏 183mm),创建时即设定尺寸,不再缩放 |
  48. | **矢量优先** | 线图/散点/柱状 → PDF/SVG;只有真正的栅格内容(热图色块/显微图)才用 ≥300dpi TIFF/PNG |
  49. ---
  50. ## 核心能力
  51. | 能力 | 说明 |
  52. |------|------|
  53. | **原型分类** | 四类范式:`quantitative_grid`(定量网格)、`schematic-led`(示意引导)、`image plate + quant`(图像-定量融合)、`asymmetric_mixed`(非对称复合)——自动驱动布局与英雄面板策略 |
  54. | **29 种图型** | 热图 / 火山图 / 柱状图 / 散点图 / 箱线图 / PCA / RDA / 雷达图 / 桑基图 / AUROC / 山脊图 / 小提琴图 / 边际密度 / 核密度 / Mantel 相关 / UpSet / 森林图 / 混淆矩阵 / 流形 / 堆叠柱散 / 配对箱线 / 标记基因点图 / 趋势线 / 3D 热图 / 频率热图 / 密度热图 / 相关矩阵 / 分组相关矩阵 / 分组小提琴——每种均有配套生产脚本(`.py` + `.R`)与预览 PNG |
  55. | **Copy-First 规则** | 生成代码前扫描 `assets/figures/<type>/`,匹配到生产脚本则**原生运行**——Python 跑 `.py`,R 跑 `.R`,不翻译、不降级质量 |
  56. | **跨类型参数继承** | 无生产脚本时,从相近图型借用 Class A(硬参数:颜色/透明度/线宽)、Class B(比例参数:字号/尺寸)、Class C(逻辑参数:图例开关/网格开关)三类视觉参数 |
  57. | **混合语言组合** | R 面板原生运行 → 输出 spec-correct PNG,Python 排版引擎按精确物理尺寸拼合多面板 |
  58. | **英雄面板自动识别** | 承载核心结论的面板自动获得更大的视觉权重,支撑面板居次排列 |
  59. | **四轮 QA 协议** | Pass 0:反模式扫描(AP-0-7)→ Pass 1:代码级合规(CL-1-7)→ Pass 2:视觉逻辑与数据完整性(VI-1-6)→ Pass 3:渲染输出验证(VV-1-5),共 30+ 项检查 |
  60. | **数据校验门禁** | 逐面板预检——火山图需 ≥10 个显著差异基因、AUROC 曲线分离需 ≥0.15、热图须有跨行方差——不通过则拒绝渲染 |
  61. | **统计与可复现报告** | 每张图强制附带:n 定义、中心统计量(均值/中位数)、散布度量(SD/SEM/95%CI)、检验名称、多重比较校正、source-data 溯源 |
  62. | **期刊配色系统** | Nature 偏冷蓝、Cell 偏暖、Science 偏保守灰;色盲友好,避免红绿独对区分 |
  63. | **审稿人模拟模式** | 从五个维度审视成品——科学清晰度、视觉层次、配色可访问性、排版可读性、整体完成度——给出 must-fix vs. suggestion 分级反馈 |
  64. ---
  65. ## 私有资产图表类型全览
  66. > 图鉴中展示的示例图表基于项目私有数据资产生成,仅作为风格参考。用户请求生成同类型图表时,脚本在保留示例所确立的视觉语言(配色、字体、布局逻辑、图元层级)的前提下,依据实际数据完成适配性重构。私有资产持续更新中。更多详情,请关注微信公众号:科研绘图酱
  67. | 图表名称 | 预览 | 图形特征 | 典型应用场景 |
  68. |---------|------|---------|-------------|
  69. | 3D 热图 | <img src="assets/figure-atlas/3Dheatmap.png" width="100"> | 立体柱面矩阵数值,高度+颜色双重编码 | 多因子交互效应、基因型×环境矩阵、三维强度分布 |
  70. | AUROC 曲线图 | <img src="assets/figure-atlas/auroc.png" width="100"> | TPR-FPR 曲线,含对角参考线与 AUC 标注 | 分类模型评估、多模型 ROC 对比、阈值敏感性分析 |
  71. | 柱状图 | <img src="assets/figure-atlas/bar.png" width="100"> | 单变量条形高度编码,支持误差棒 | 组间均值比较、单指标排序、计数统计 |
  72. | 相关性密度图 | <img src="assets/figure-atlas/CorrelationDensity.png" width="100"> | 散点叠加二维核密度等高线 | 两变量关系强弱、密集区识别、异常点检测 |
  73. | 相关性矩阵图 | <img src="assets/figure-atlas/Correlationmatrix.png" width="100"> | 方形网格,色阶+数值双重展示成对相关系数 | 多变量相关性总览、特征筛选前共线性检查 |
  74. | 密度热图 | <img src="assets/figure-atlas/density_heatmap.png" width="100"> | 连续二维核密度颜色梯度铺满网格 | 大样本点云密度分布、替代过度重叠散点图 |
  75. | 频率 3D 热图 | <img src="assets/figure-atlas/Frequency_3DHeatmap.png" width="100"> | 立体柱面展示分箱频次 | 等位基因频率分布、双因子计数交叉展示 |
  76. | 分组相关性矩阵图 | <img src="assets/figure-atlas/GroupCorrelationmatrix.png" width="100"> | 按分组拆分的多个相关矩阵并列呈现 | 不同处理/环境下相关结构差异比较 |
  77. | 分组柱状图 | <img src="assets/figure-atlas/GroupedBarChart.png" width="100"> | 同一类别下并列多个子组条形 | 多处理×多指标对比、重复实验组间差异 |
  78. | Mantel 相关性检验图 | <img src="assets/figure-atlas/MantelCorrelation.png" width="100"> | 相关矩阵热图叠加连线标注 r 值与显著性 | 环境因子与群落/基因型矩阵关联、距离矩阵分析 |
  79. | PCA 主成分分析图 | <img src="assets/figure-atlas/PCA.png" width="100"> | 样本投影至 PC 平面,附椭圆置信区间 | 群体结构分析、样本聚类趋势、降维可视化 |
  80. | 雷达图 | <img src="assets/figure-atlas/radar.png" width="100"> | 多轴放射排列,闭合多边形综合表现 | 多指标品种/模型综合评估、性状剖面对比 |
  81. | 山脊图 | <img src="assets/figure-atlas/RidgePlot.png" width="100"> | 多组密度曲线纵向错落叠放 | 多组/多时间点分布形态对比、性状分布趋势 |
  82. | 桑基图 | <img src="assets/figure-atlas/sankey.png" width="100"> | 节点间流量宽度编码,多阶段流转 | 通路/流程转化路径、类别间流动归因分解 |
  83. | 堆叠柱状散点复合图 | <img src="assets/figure-atlas/StackedBarScatter.png" width="100"> | 堆叠柱体+叠加散点标注个体数值 | 组成结构展示同时保留原始样本点 |
  84. | 趋势图 | <img src="assets/figure-atlas/trend.png" width="100"> | 折线随连续变量走势,可含置信带 | 性状随环境梯度变化、时间序列走势 |
  85. | 小提琴图 | <img src="assets/figure-atlas/violin_chart.png" width="100"> | 镜像密度轮廓呈现分布形状 | 组间分布形态与离散程度比较、非正态数据展示 |
  86. ---
  87. ## 系统工作流
  88. ```text
  89. ┌─────────────────────────────────────────────────────────────┐
  90. │ User Intent Parsing / 用户意图解析 │
  91. └─────────────────────────────────────────────────────────────┘
  92. Step -1 需求澄清 │ 逆向提问锚定分析目标:"这份数据要回答什么问题?"
  93. Step 0a 原型识别 │ 四类范式判定:定量网格 / 示意引导 / 图像-定量融合 / 非对称复合
  94. Step 0b 数据解析 │ 问题驱动的结构化解析,拒绝模板化套用
  95. Step 1 图型论证 │ 循证式选型:N 个面板对应 N 个独立科学问题
  96. Step 2 环境探测 │ 运行时自检(Python / R 内核、依赖完整性)
  97. Step 3 风格注入 │ 视觉基线固化:字体系统 + 配色方案 + 导出规格
  98. Step 4 资产检索 │ 扫描 assets/figures/<type>/,逐面板匹配已有生产脚本
  99. Step 5 渲染生成 │ Copy-First 原生运行或跨类型参数继承
  100. Step 5.5 数据校验 │ 逐面板预判图表可用性,不通过则拒绝渲染
  101. Step 6 质量验证 │ 四轮 QA 协议,30+ 项检查点
  102. Step 7 成果交付 │ 矢量 PDF + 300dpi PNG + 统计报告 + QA 报告
  103. ```
  104. **核心原则**:问题驱动而非模板驱动——图型选择基于科学问题的数量与结构,视觉风格通过资产库进行继承而非从零构建。
  105. ---
  106. ## 安装与使用
  107. `academic-figure-skill` 是一个以 `SKILL.md` 为核心的 Skill 包。完整安装需保留 `references/`、`scripts/`、`assets/`、`install/` 等目录,Skill 依赖这些文件完成视觉基线注入、资产检索和跨平台适配。
  108. ### Claude Code
  109. 如果尚未安装 Claude Code:
  110. ```bash
  111. npm install -g @anthropic-ai/claude-code
  112. claude
  113. ```
  114. 克隆仓库到稳定路径并安装 Skill:
  115. ```bash
  116. mkdir -p ~/ai-skills
  117. cd ~/ai-skills
  118. git clone https://github.com/TingxiYu/academic-figure-skill.git
  119. cp -r academic-figure-skill ~/.claude/skills/
  120. ```
  121. 安装后在 Claude Code 会话中直接描述需求即可自动触发:
  122. ```text
  123. 请使用 academic-figure-skill 分析项目文件中的multip-traits.csv数据,并进行可视化分析。
  124. ```
  125. ```text
  126. 用academic-figure-skill将data.csv数据绘制为一个 Nature 风格的差异表达火山图。
  127. ```
  128. 如需更新:
  129. ```bash
  130. cd ~/ai-skills/academic-figure-skill
  131. git pull
  132. cp -r . ~/.claude/skills/academic-figure-skill/
  133. ```
  134. ### Codex
  135. Codex 支持通过 `install/codex/` 中的 `manifest.yaml` + `instructions.md` 加载 Skill。将以下目录复制到 `~/.codex/skills/academic-figure-skill/`:
  136. ```bash
  137. git clone https://github.com/TingxiYu/academic-figure-skill.git
  138. cd academic-figure-skill
  139. mkdir -p ~/.codex/skills/academic-figure-skill
  140. cp -r SKILL.md references/ scripts/ assets/ install/codex/* ~/.codex/skills/academic-figure-skill/
  141. ```
  142. 安装后在 Codex 会话中自然描述需求,Skill 会根据 `manifest.yaml` 中的触发规则自动激活。
  143. 也可以让 Codex 代为安装:
  144. ```text
  145. 从 https://github.com/TingxiYu/academic-figure-skill.git 安装 Codex skill。
  146. 克隆仓库后,将 SKILL.md、references/、scripts/、assets/ 和 install/codex/ 复制到 ~/.codex/skills/academic-figure-skill/。
  147. 保持完整目录结构,不要只复制 SKILL.md。
  148. ```
  149. ### Cursor
  150. 将 Skill 规则文件复制到项目根目录,Cursor 在生成代码时会自动遵循其中的规范:
  151. ```bash
  152. git clone https://github.com/TingxiYu/academic-figure-skill.git
  153. cp academic-figure-skill/install/cursor/.cursorrules <your-project>/.cursorrules
  154. ```
  155. `.cursorrules` 包含了配色方案、排版基线、导出规格等核心规则。如需更新规则,重新执行上述复制命令即可。
  156. ### GitHub Copilot
  157. 将 Skill 指令文件复制到项目的 `.github/` 目录,Copilot 在生成代码时会加载这些上下文:
  158. ```bash
  159. git clone https://github.com/TingxiYu/academic-figure-skill.git
  160. mkdir -p <your-project>/.github
  161. cp academic-figure-skill/install/copilot/copilot-instructions.md <your-project>/.github/
  162. ```
  163. 如果已有 `.github/copilot-instructions.md`,建议将本 Skill 的内容追加到文件末尾。
  164. ### 其他 Agent
  165. 对于其他 AI 编程助手:
  166. 1. 保持仓库的稳定克隆副本
  167. 2. 创建一个轻量级的 subagent、slash command 或自定义 prompt wrapper,指向 `SKILL.md`
  168. 3. 确保 `references/`、`scripts/`、`assets/` 等目录与 `SKILL.md` 保持在同一相对路径下
  169. 4. 如果 Agent 有特殊的格式要求,可基于 `SKILL.md` 调整 frontmatter 和 body 结构
  170. ---
  171. ## 项目结构
  172. ```text
  173. academic-figure-skill/ ← 核心 Skill 包(本目录)
  174. ├── README.md ← 项目说明文档(本文件)
  175. ├── LICENSE ← MIT 许可证
  176. ├── SKILL.md ← 技能入口:8 步闭环工作流 + 全部规则
  177. ├── references/ ← 16 份共享知识文档
  178. │ ├── figure-contract.md ← 图表合同:核心结论 + 证据链 + 审稿风险
  179. │ ├── color-palettes.md ← 配色系统:分类/发散/连续 + 色盲友好
  180. │ ├── typography.md ← 字体规范:Arial/Helvetica, ≥5pt 底限
  181. │ ├── journal-specs.md ← 期刊尺寸:单栏 89mm / 双栏 183mm
  182. │ ├── export-specs.md ← 导出规格:PDF/SVG 矢量 + 300dpi PNG
  183. │ ├── multipanel-layout.md ← 多面板排版:反冗余 + 英雄面板 + 叙事顺序
  184. │ ├── directory-map.md ← 图型目录映射:中英文关键词 → 资产路径
  185. │ ├── checklist.md ← 完整 QA 检查清单
  186. │ ├── common-pitfalls.md ← 常见陷阱与解决方案
  187. │ ├── revision-cases.md ← 审稿修改案例库
  188. │ ├── journal-intel.md ← 各期刊特有情报
  189. │ ├── figure-deconstruction.md ← 图表解构:构图灵感参考
  190. │ ├── matplotlib.md ← Python/matplotlib/seaborn 指南
  191. │ ├── complexheatmap.md ← R ComplexHeatmap 指南
  192. │ ├── r-rendering.md ← R PNG 渲染规范(cairo 设备)
  193. │ └── compose.R ← R 排版参考实现
  194. ├── scripts/ ← 编译引擎 + QA 工具 + 评估套件
  195. │ ├── compose.py ← 多面板排版引擎
  196. │ ├── eval_runner.py ← 全量资产审计(29 类型自动扫描)
  197. │ ├── trigger_benchmark.py ← 触发准确率基准测试
  198. │ ├── qa_coverage.py ← QA 检查覆盖度验证
  199. │ ├── qa_validator.py ← 代码自动检查(AP-0~CL-7)
  200. │ ├── check_references.py ← 引用完整性校验
  201. │ ├── e2e_runner.py ← E2E 集成测试(A/B 场景自动评分)
  202. │ ├── check_colors.py ← 配色合规检查
  203. │ ├── check_dimensions.py ← 尺寸规范检查
  204. │ ├── check_export.py ← 导出参数检查
  205. │ ├── check_fontsize.py ← 字号合规检查
  206. │ ├── check_figure.py ← 图表综合检查
  207. │ ├── generate_adapters.py ← 跨平台适配文件生成
  208. │ ├── generate_atlas.py ← 图鉴自动生成
  209. │ └── run_ab_tests.py ← A/B 测试运行器
  210. ├── assets/
  211. │ ├── figures/ ← 29+ 种图型生产脚本与预览
  212. │ │ ├── 3DHeatmap/ ← 3D 热图(R/ComplexHeatmap)
  213. │ │ ├── AUROC/ ← AUROC 曲线
  214. │ │ ├── BarAblation/ ← 消融实验柱状图
  215. │ │ ├── BarCategorical/ ← 分类柱状图
  216. │ │ ├── BarComparison/ ← 模型对比柱状图
  217. │ │ ├── BarComposition/ ← 组成柱状图
  218. │ │ ├── BarDistribution/ ← 分布柱状图
  219. │ │ ├── ConfusionMatrix/ ← 混淆矩阵
  220. │ │ ├── CorrelationMatrix/ ← 相关性矩阵(ggpairs)
  221. │ │ ├── DensityHeatmap/ ← 密度热图
  222. │ │ ├── Frequency_3DHeatmap/ ← 频率 3D 热图
  223. │ │ ├── GroupedBarChart/ ← 分组柱状图
  224. │ │ ├── GroupedCorrelationMatrix/ ← 分组相关矩阵
  225. │ │ ├── GroupedViolin/ ← 分组小提琴图
  226. │ │ ├── KernelDensity/ ← 核密度估计
  227. │ │ ├── LineTrend/ ← 趋势折线图
  228. │ │ ├── Manifold/ ← 流形可视化
  229. │ │ ├── MantelCorrelation/ ← Mantel 相关性检验
  230. │ │ ├── MarginalDensity/ ← 边际密度图
  231. │ │ ├── MarkerGeneDotPlot/ ← 标记基因点图
  232. │ │ ├── PCA/ ← PCA 主成分分析
  233. │ │ ├── PairedBoxScatter/ ← 配对箱线散点图
  234. │ │ ├── Radar/ ← 雷达图
  235. │ │ ├── RidgePlot/ ← 山脊密度图
  236. │ │ ├── SankeyDiagram/ ← 桑基流图
  237. │ │ ├── StackedBarScatter/ ← 堆叠柱状散点复合图
  238. │ │ ├── Violin/ ← 小提琴图
  239. │ │ ├── heatmap/ ← 聚类热图
  240. │ │ ├── volcano/ ← 火山图
  241. │ │ ├── basic-plots/ ← 基础图型
  242. │ │ ├── multipanel/ ← 多面板模板
  243. │ │ └── other/ ← 长尾图型
  244. │ └── figure-atlas/ ← 图鉴预览 PNG 合集
  245. └── install/ ← 跨平台适配
  246. ├── claude-code/ ← Claude Code(原生支持,开箱即用)
  247. ├── cursor/ ← Cursor IDE 适配
  248. ├── copilot/ ← GitHub Copilot 适配
  249. └── codex/ ← Codex CLI 适配
  250. ```
  251. ---
  252. ## 质量评估与测试
  253. ### QA 四级协议
  254. | 轮次 | 名称 | 检查项数 | 说明 |
  255. |------|------|---------|------|
  256. | Pass 0 | 反模式扫描 (AP) | 8 | 默认色板、四边边框、图例内置、截图导出、jet 色条、无散点柱状图、默认字体、大样本未栅格化 |
  257. | Pass 1 | 代码合规 (CL) | 7 | 排版基线、配色方案、导出规格、资产确认表、无降采样、图表尺寸、期刊规范 |
  258. | Pass 2 | 视觉逻辑 (VI) | 6 | 数据范围、热图方差、相关性强度、PCA 分离度、分布形态、数据丢失透明度 |
  259. | Pass 3 | 渲染验证 (VV) | 5 | PDF 生成、PNG 生成、非零文件、字体嵌入、尺寸正确 |
  260. ### 运行评估
  261. ```bash
  262. # 全量资产评估
  263. python scripts/eval_runner.py
  264. # 单类型评估
  265. python scripts/eval_runner.py --type Heatmap
  266. # E2E 集成测试
  267. python scripts/e2e_runner.py
  268. # 触发准确率基准
  269. python scripts/trigger_benchmark.py
  270. ```
  271. ---
  272. ## 贡献指南
  273. Academic Figure Skill 采用 Skill 插件架构,添加新图型只需:
  274. 1. 在 `assets/figures/` 下创建新目录 `<FigureType>/`
  275. 2. 放入生产脚本(`.py` 或 `.R`)和预览 PNG
  276. 3. 在 `references/directory-map.md` 中添加关键词映射
  277. 4. 运行 `python scripts/eval_runner.py --type <FigureType>` 验证通过
  278. ---
  279. ## 许可证
  280. [Apache 2.0](LICENSE) © 2025 Academic Figure Skill

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.