drawio-paper
Generate publication-quality academic paper diagrams (.drawio) and statistical plots (.png via Python/matplotlib) using a PaperBanana-inspired multi-agent pipeline. Reads methodology sections, figure captions, and raw data to produce structured, aesthetically refined visualizations with reference-driven design.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- drawio-paper
- description
- Generate publication-quality academic paper diagrams (.drawio) and statistical plots (.png via Python/matplotlib) using a PaperBanana-inspired multi-agent pipeline. Reads methodology sections, figure captions, and raw data to produce structured, aesthetically refined visualizations with reference-driven design.
- allowed-tools
- Bash, Write, Read, Glob
02 资源文件 4
- 参考文档evals/evals.json2.6 KB
- 参考文档neurips2025_diagram_style_guide.md6.1 KB
- 参考文档neurips2025_plot_style_guide.md5.9 KB
- 脚本scripts/extract_bench.py3.1 KB
03 SKILL.md 正文
Academic Paper Visualization Skill (Diagrams + Plots)
Generate publication-quality academic paper visualizations using a structured multi-agent pipeline inspired by PaperBanana. This skill supports two output modes:
- Diagram mode: Transforms methodology sections and figure captions into polished
.drawiodiagrams through retrieval, planning, styling, visualization (XML generation), and critique stages. - Plot mode: Transforms raw data (tabular/JSON) and visual intent into publication-ready statistical plots via Python/matplotlib code generation, following the same retrieval, planning, styling, visualization (code generation + execution), and critique pipeline.
Setup (run once before first use)
Before generating diagrams or plots, ensure the PaperBananaBench reference dataset is available locally. Check if {skill_dir}/PaperBananaBench/diagram/ref.json and {skill_dir}/PaperBananaBench/plot/ref.json both exist. If either is missing, run the following setup steps:
# 1. Download PaperBananaBench.zip directly from Hugging Face
curl -L -o "{skill_dir}/PaperBananaBench.zip" https://huggingface.co/datasets/dwzhu/PaperBananaBench/resolve/main/PaperBananaBench.zip
# 2. Run the bundled extraction script (works on Windows, macOS, Linux)
python "{skill_dir}/scripts/extract_bench.py"
Python environment for plots
Plots are generated using Python + matplotlib. Ensure the following packages are available:
pip install matplotlib numpy pillow
Important notes:
{skill_dir}refers to the directory containing this SKILL.md file (.claude/skills/drawio-paper/)- Only requires
curland Python (stdlibzipfile), no git or git-lfs needed - Python extraction is used instead of
unzipto reliably handle long paths on Windows - If the download fails due to network issues, retry or ask the user to manually download from https://huggingface.co/datasets/dwzhu/PaperBananaBench/resolve/main/PaperBananaBench.zip and place it at
{skill_dir}/PaperBananaBench.zip, then run the Python extraction step - After setup,
{skill_dir}/PaperBananaBench/diagram/and{skill_dir}/PaperBananaBench/plot/should each containref.json,test.json, and animages/folder with reference images
When to use this skill
Diagram mode
Use when the user wants to create academic paper diagrams, such as:
- Framework/architecture overview diagrams
- Pipeline/workflow diagrams
- Method illustration diagrams
- Module detail diagrams
- System design diagrams for research papers
Trigger keywords: "paper diagram", "academic diagram", "method diagram", "framework diagram", "pipeline diagram", "research figure", "paper figure", "drawio paper", "academic illustration"
Plot mode
Use when the user wants to create publication-quality statistical plots, such as:
- Bar charts, grouped bar charts, stacked bar charts
- Line charts with confidence intervals
- Scatter plots with shape/color coding
- Heatmaps and confusion matrices
- Radar/spider charts
- Pie/donut charts
- Box plots, violin plots
- Any statistical visualization for academic papers
Trigger keywords: "paper plot", "academic plot", "research plot", "statistical plot", "bar chart", "line chart", "scatter plot", "heatmap", "paper chart", "matplotlib plot", "publication plot", "results plot", "comparison plot"
Mode detection
- If the user provides methodology text + figure caption → Diagram mode
- If the user provides raw data (table/JSON/CSV) + visual intent → Plot mode
- If ambiguous, ask the user which mode they want
Pipeline overview
Follow this 5-stage pipeline to generate each visualization (diagram or plot). Stages 1-3 and 5 share the same structure for both modes; Stage 4 differs based on the output type.
Stage 1: Reference Retrieval
Before generating, always look at reference images from the benchmark dataset to understand the visual style expected.
For Diagram mode:
- Read the reference metadata from
{skill_dir}/PaperBananaBench/diagram/ref.jsonand{skill_dir}/PaperBananaBench/diagram/test.json - Based on the user's topic (domain) and visual intent (diagram type), select 3-5 relevant reference images to study
- Use the Read tool to view the selected reference images from
{skill_dir}/PaperBananaBench/diagram/images/ - Note the visual patterns: layout structure, color schemes, grouping strategies, icon usage, arrow styles
For Plot mode:
- Read the reference metadata from
{skill_dir}/PaperBananaBench/plot/ref.jsonand{skill_dir}/PaperBananaBench/plot/test.json - Based on the user's data type and desired plot type, select 3-5 relevant reference plot images to study
- Use the Read tool to view the selected reference images from
{skill_dir}/PaperBananaBench/plot/images/ - Note the visual patterns: color palette, axis styling, legend placement, annotation style, chart type conventions
Selection logic (from PaperBanana Retriever Agent):
- Match Research Topic: Find references in the same domain (e.g., Agent/Reasoning, Vision/Perception, Generative/Learning, Science/Applications)
- Match Visual Intent: Find references with similar visualization types (e.g., Framework diagram, Bar chart, Line chart, Heatmap)
- Priority: Same Topic + Same Visual Intent > Same Visual Intent > Same Topic
Stage 2: Planning
Based on the user's input and the reference images studied, create a detailed textual description.
For Diagram mode (input: methodology section + figure caption):
-
Create a detailed textual description of the diagram to generate, including:
- All components and their relationships
- Data flow direction (typically left-to-right or top-to-bottom)
- Grouping/containment hierarchy
- Labels for every element
- Mathematical notation where appropriate
-
The description should be as detailed as possible:
- Clearly describe each element and their connections
- Include background style, colors, line thickness, icon styles
- Specify layout structure (horizontal pipeline, vertical stack, grid, etc.)
For Plot mode (input: raw data + visual intent):
-
Create a detailed textual description of the plot to generate, including:
- Precise mapping of variables to visual channels (x-axis, y-axis, hue/color, size, shape)
- Explicitly enumerate every raw data point's coordinate to ensure accuracy
- Chart type selection and justification
- All axis labels, tick values, and units
- Legend content and placement
-
The description should specify exact aesthetic parameters:
- Specific HEX color codes for each data series
- Font sizes for all labels (title, axes, ticks, legend, annotations)
- Line widths, marker dimensions, bar widths
- Grid style (dashed/dotted, color, alpha)
- Legend placement (inside plot, top horizontal, etc.)
Stage 3: Style Refinement
For Diagram mode:
Apply the NeurIPS 2025 academic diagram style guide (stored at {skill_dir}/neurips2025_diagram_style_guide.md) to refine the planned description:
Key style principles:
- Color: "Soft Tech & Scientific Pastels" - use light pastel backgrounds (#E6F3FF, #F3E5F5, #E0F2F1, #F5F5DC) for zones, medium saturation for active modules
- Shapes: "Softened Geometry" - rounded rectangles for processes, 3D cuboids for tensors, cylinders for databases
- Lines: Orthogonal edges for architectures, curved for data flow; solid for forward pass, dashed for auxiliary/gradient flow
- Typography: Sans-serif (Arial) for labels, serif (Times New Roman) for math variables
- Icons: Use semantic icons (snowflake=frozen, fire=trainable, gear=processing)
- Background: Pure white or very light pastels; avoid saturated backgrounds
- No figure caption text inside the diagram itself
Domain-specific styles:
- Agent/LLM papers: Illustrative, friendly, chat bubbles, robot avatars
- Computer Vision/3D: Spatial, dense, geometric, RGB color coding, heatmaps
- Theoretical/Optimization: Minimalist, abstract, graph nodes, mostly grayscale
For Plot mode:
Apply the NeurIPS 2025 statistical plot aesthetics guide (stored at {skill_dir}/neurips2025_plot_style_guide.md) to refine the planned description. Focus on specifying visual attributes without altering data content.
Key style principles:
- Color palettes: Soft pastels for categorical data; Viridis/Magma for sequential; avoid Jet/Rainbow
- Axes & grids: Fine dashed or dotted grid lines in light gray, behind data; either "boxed" (4 spines) or "open" (no top/right)
- Typography: Sans-serif fonts (Arial, Helvetica, DejaVu Sans); rotate x-labels 45° only when necessary
- Legends: Float inside plot area or place as horizontal row above plot
- Annotations: Prefer direct labeling over forcing legend references
- Background: White or very light gray (Seaborn-style)
- Accessibility: Combine color with shape/pattern (hatches, markers) for colorblind support
- No figure caption inside the plot itself
Chart-type-specific guidelines:
- Bar charts: Black outlines or borderless fills; tight grouping; error bars with black flat caps
- Line charts: Always include geometric markers at data points; dashed lines for baselines; shaded confidence bands
- Scatter plots: Different marker shapes for categories; solid opaque fills
- Heatmaps: Square cells; annotate exact values inside cells; use perceptually uniform colormaps
- Pie/Donut: Thick donut preferred; white borders between slices; explode key slices
- Radar charts: Translucent polygon fills (alpha ~0.2); solid outer perimeter
Stage 4: Visualization Generation
Choose the appropriate sub-stage based on mode:
Stage 4A: Draw.io XML Generation (Diagram mode)
Transform the styled description into draw.io XML. Follow ALL rules from the base drawio skill:
Basic XML structure
<mxGraphModel>
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<!-- Diagram cells go here with parent="1" -->
</root>
</mxGraphModel>
Academic diagram design patterns
Pattern 1: Horizontal Pipeline (most common)
- Left-to-right flow with major stages as titled swimlane containers
- Internal components as rounded rectangles within each stage
- Arrows connecting stages with orthogonal edges
Pattern 2: Vertical Architecture Stack
- Top-to-bottom layer stack (input at top, output at bottom)
- Each layer as a rounded rectangle with fill color indicating type
- Skip connections shown as curved dashed lines
Pattern 3: Multi-module Detail
- Central overview with breakout detail boxes connected by lines
- "Macro-Micro" pattern: overview container + zoomed-in module details
Color palette for academic diagrams
| Purpose | Color | Hex |
|---|---|---|
| Background zone - blue | Pale Ice Blue | #E6F3FF |
| Background zone - green | Pale Mint | #E0F2F1 |
| Background zone - purple | Pale Lavender | #F3E5F5 |
| Background zone - warm | Cream/Beige | #FFF8E1 |
| Active module - blue | Soft Blue | #DAE8FC |
| Active module - green | Soft Green | #D5E8D4 |
| Active module - orange | Soft Orange | #FFE6CC |
| Active module - pink | Soft Pink | #F8CECC |
| Frozen/static element | Light Grey | #F5F5F5 |
| Highlight/output | Gold accent | #FFF2CC |
| Trainable element | Warm tone | #FFE0B2 |
| Frozen element | Cool grey | #E0E0E0 |
| Border - blue | Medium Blue | #6C8EBF |
| Border - green | Medium Green | #82B366 |
| Border - orange | Medium Orange | #D6B656 |
| Border - red | Medium Red | #B85450 |
Layout rules
- Generous spacing: At least 200px horizontal gap, 120px vertical gap between major groups
- Grid alignment: Align all nodes to multiples of 10
- Container padding: At least 20px padding inside containers; startSize=30 for swimlane headers
- Font sizes: 14-16px for major labels, 11-12px for detail labels, 10px for annotations
- Edge routing: Use orthogonalEdgeStyle with rounded=1 for clean bends
- Leave room for arrowheads: At least 20px straight segment before targets
Container usage for grouping
Use draw.io containers for logical grouping (stages, modules):
<!-- Stage container using swimlane -->
<mxCell id="stage1" value="Stage 1: Encoding" style="swimlane;startSize=30;fillColor=#E6F3FF;strokeColor=#6C8EBF;rounded=1;arcSize=8;fontStyle=1;fontSize=14;fontFamily=Arial;" vertex="1" parent="1">
<mxGeometry x="40" y="80" width="300" height="400" as="geometry"/>
</mxCell>
<!-- Components inside the stage (note parent="stage1" and relative coords) -->
<mxCell id="enc1" value="Encoder" style="rounded=1;whiteSpace=wrap;fillColor=#DAE8FC;strokeColor=#6C8EBF;fontSize=12;fontFamily=Arial;" vertex="1" parent="stage1">
<mxGeometry x="20" y="50" width="120" height="50" as="geometry"/>
</mxCell>
Math notation in labels
Use HTML formatting for mathematical symbols:
<mxCell id="loss" value="<i>L</i> = &sum; <i>L</i><sub>i</sub>" style="text;html=1;align=center;fontFamily=Times New Roman;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="200" y="500" width="100" height="30" as="geometry"/>
</mxCell>
Semantic icons as text labels
Use Unicode/emoji characters in value attributes for semantic icons. Place them as standalone text cells or inline with labels.
<mxCell id="icon_example" value="❄" style="text;fontSize=16;align=center;" vertex="1" parent="1">
<mxGeometry x="150" y="90" width="24" height="24" as="geometry"/>
</mxCell>
Complete emoji reference for academic diagrams:
Model State
| Icon | Emoji | HTML Entity | Meaning | Usage |
|---|---|---|---|---|
| Snowflake | ❄ | ❄ |
Frozen / Non-trainable | Frozen encoder, fixed weights |
| Fire | 🔥 | 🔥 |
Trainable / Active learning | Fine-tuning layers, trainable heads |
| Lightning | ⚡ | ⚡ |
Fast / Accelerated | Efficient inference, speedup |
| Lock | 🔒 | 🔒 |
Locked / Protected | Frozen parameters, access control |
| Unlock | 🔓 | 🔓 |
Unlocked / Released | Unfrozen for training |
| Stop sign | 🛑 | 🛑 |
Stopped / Blocked | Non-trainable, gradient stop |
Agents & Roles
| Icon | Emoji | HTML Entity | Meaning | Usage |
|---|---|---|---|---|
| Robot | 🤖 | 🤖 |
AI Agent / Model | LLM agent, autonomous module |
| Person | 👤 | 👤 |
User / Human | Human input, user query |
| People | 👥 | 👥 |
Multi-user / Crowd | Collaborative systems, multi-user |
| Brain | 🧠 | 🧠 |
Reasoning / Intelligence | LLM core, reasoning module |
| Thinking | 🤔 | 🧐 |
Evaluation / Critique | Critic agent, reviewer |
| Detective | 🕵 | 🕵 |
Investigation / Analysis | Anomaly detection, inspection |
| Teacher | 👨🏫 | 👨‍🏫 |
Teaching / Supervision | Teacher model, supervisor |
| Student | 👨🎓 | 👨‍🎓 |
Learning / Student | Student model, distillation target |
Data & Content
| Icon | Emoji | HTML Entity | Meaning | Usage |
|---|---|---|---|---|
| Document | 📄 | 📄 |
Text / Document | Input text, paper, prompt |
| Clipboard | 📋 | 📋 |
Plan / List | Structured plan, task list |
| Folder | 📁 | 📁 |
Dataset / Collection | Data directory, file collection |
| File cabinet | 🗃 | 🗃 |
Storage / Archive | Knowledge base, data store |
| Database | 🗄 | 🗄 |
Database / Repository | Vector DB, model repository |
| Image | 🖼 | 🖼 |
Image / Visual data | Image input, visual features |
| Speech | 💬 | 💬 |
Chat / Dialogue | Prompt, conversation, chat bubble |
| Label | 🏷 | 🏷 |
Tag / Annotation | Class label, metadata tag |
| Book | 📚 | 📚 |
Knowledge / Corpus | Training corpus, reference library |
| Newspaper | 📰 | 📰 |
Article / Report | Paper, news, generated report |
Operations & Processing
| Icon | Emoji | HTML Entity | Meaning | Usage |
|---|---|---|---|---|
| Gear | ⚙ | ⚙ |
Processing / Computation | Model inference, computation |
| Magnifier | 🔍 | 🔍 |
Search / Retrieval | Retrieval, attention, inspection |
| Wrench | 🔧 | 🔧 |
Configuration / Tuning | Hyperparameter tuning, adjustment |
| Scissors | ✂ | ✂ |
Pruning / Cutting | Model pruning, token trimming |
| Filter | 🔽 | 🔽 |
Filtering / Selection | Feature selection, data filtering |
| Shuffle | 🔀 | 🔀 |
Random / Shuffle | Data augmentation, random sampling |
| Cycle | 🔄 | 🔄 |
Loop / Iteration | Iterative refinement, feedback loop |
| Link | 🔗 | 🔗 |
Connection / Linking | Cross-attention, entity linking |
| Merge | 🔀 | 🔀 |
Merge / Combine | Feature fusion, model merging |
Evaluation & Results
| Icon | Emoji | HTML Entity | Meaning | Usage |
|---|---|---|---|---|
| Checkmark | ✅ | ✅ |
Pass / Correct | Correct prediction, quality pass |
| Cross | ❌ | ❌ |
Fail / Incorrect | Wrong prediction, rejected |
| Trophy | 🏆 | 🏆 |
Best / Winner | Best model, SOTA result |
| Chart up | 📈 | 📈 |
Improvement / Growth | Performance gain, metric increase |
| Chart down | 📉 | 📉 |
Decline / Degradation | Performance drop, quality loss |
| Target | 🎯 | 🎯 |
Goal / Objective | Target task, loss objective |
| Star | ⭐ | ⭐ |
Highlight / Key result | Key contribution, important |
| Warning | ⚠ | ⚠ |
Caution / Issue | Potential problem, limitation |
Domain-Specific
| Icon | Emoji | HTML Entity | Meaning | Usage |
|---|---|---|---|---|
| Eye | 👁 | 👁 |
Vision / Observation | Visual encoder, image perception |
| Ear | 👂 | 👂 |
Audio / Listening | Speech recognition, audio input |
| Pen | ✍ | ✍ |
Writing / Generation | Text generation, authoring |
| Globe | 🌐 | 🌐 |
Web / Global | Internet retrieval, world knowledge |
| DNA | 🧬 | 🧬 |
Biology / Sequence | Protein, genomics, molecular |
| Atom | ⚛ | ⚛ |
Physics / Science | Scientific computing, simulation |
| Microscope | 🔬 | 🔬 |
Research / Analysis | Detailed analysis, micro-level |
| Telescope | 🔭 | 🔭 |
Far-sighted / Overview | Macro-level, global view |
| Pill | 💊 | 💊 |
Medical / Drug | Drug discovery, medical AI |
| Tree | 🌳 | 🌳 |
Tree structure / Hierarchy | Decision tree, parse tree |
| Network | 🕸 | 🕸 |
Graph / Network | Neural network, knowledge graph |
| Dice | 🎲 | 🎲 |
Random / Stochastic | Sampling, probability, noise |
| Thermometer | 🌡 | 🌡 |
Temperature | Softmax temperature, scaling |
| Hourglass | ⏳ | ⏳ |
Time / Temporal | Time series, sequence, latency |
| Layer | 📊 | 📊 |
Layers / Stack | Model layers, feature maps |
| Key | 🔑 | 🔑 |
Key / Authentication | Attention key, API key, decryption |
| Light bulb | 💡 | 💡 |
Idea / Insight | Innovation, key finding |
| Rocket | 🚀 | 🚀 |
Launch / Deploy | Model deployment, fast execution |
| Shield | 🛡 | 🛡 |
Defense / Protection | Adversarial defense, safety |
| Sword | ⚔ | ⚔ |
Attack / Adversarial | Adversarial attack, red-teaming |
Mathematical Operators (use with fontFamily=Times New Roman)
| Symbol | Name | HTML Entity | Usage |
|---|---|---|---|
| ⊕ | Circled plus | ⊕ |
Element-wise addition, concatenation |
| ⊗ | Circled times | ⊗ |
Element-wise multiplication, outer product |
| ⊙ | Circled dot | ⊙ |
Hadamard product, dot product |
| ∑ | Summation | ∑ |
Sum, aggregation |
| ∏ | Product | ∏ |
Product operation |
| → | Right arrow | → |
Mapping, transformation |
| ↔ | Left-right arrow | ↔ |
Bidirectional, mutual |
| σ | Sigma | σ |
Sigmoid, activation |
| ∇ | Nabla | ∇ |
Gradient |
| ∞ | Infinity | ∞ |
Unbounded, continuous |
| ∈ | Element of | ∈ |
Membership, belongs to |
| ≈ | Approximately | ≈ |
Approximation |
| ∥ | Parallel | ∥ |
Norm, parallel |
Dashed lines for auxiliary flow
<mxCell id="grad_flow" value="Gradient" style="edgeStyle=orthogonalEdgeStyle;dashed=1;strokeColor=#999999;fontColor=#999999;fontSize=10;" edge="1" source="loss_node" target="encoder" parent="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
Mathematical operators on edges
<!-- Addition operator on connection -->
<mxCell id="add_op" value="⊕" style="ellipse;whiteSpace=wrap;fillColor=#FFFFFF;strokeColor=#666666;fontSize=14;fontFamily=Times New Roman;aspect=fixed;" vertex="1" parent="1">
<mxGeometry x="295" y="195" width="30" height="30" as="geometry"/>
</mxCell>
Stage 4B: Python/Matplotlib Code Generation (Plot mode)
Transform the styled description into a complete, self-contained Python script using matplotlib. The script must generate and save a publication-quality plot.
Code generation rules
-
Self-contained script: The generated Python code must be a single, complete script that can run independently. All data must be embedded directly in the code (no external file reads).
-
Required imports: Always include these at the top:
import matplotlib
matplotlib.use('Agg') # Headless backend - MUST be before pyplot import
import matplotlib.pyplot as plt
import numpy as np
-
Reset defaults: Always call
plt.rcdefaults()before setting custom styles to avoid inheriting stale state. -
Output format: Save the plot as PNG at 300 DPI with tight bounding box:
plt.savefig('output_filename.png', format='png', dpi=300, bbox_inches='tight', facecolor='white')
plt.close('all')
- No interactive elements: Never use
plt.show(). Always useplt.savefig()only.
Matplotlib style template
Apply these NeurIPS 2025 style settings programmatically:
# Font settings
plt.rcParams.update({
'font.family': 'sans-serif',
'font.sans-serif': ['Arial', 'Helvetica', 'DejaVu Sans'],
'font.size': 12,
'axes.titlesize': 14,
'axes.labelsize': 13,
'xtick.labelsize': 11,
'ytick.labelsize': 11,
'legend.fontsize': 11,
})
# Grid and spine settings
plt.rcParams.update({
'axes.grid': True,
'grid.alpha': 0.3,
'grid.linestyle': '--',
'grid.color': '#cccccc',
'axes.spines.top': True, # or False for "open" look
'axes.spines.right': True, # or False for "open" look
})
# Figure settings
plt.rcParams.update({
'figure.facecolor': 'white',
'axes.facecolor': 'white',
'savefig.facecolor': 'white',
'figure.figsize': (8, 6), # Adjust per chart type
})
Recommended color palettes
Categorical (soft pastels for academic look):
# Soft academic palette
COLORS_PASTEL = ['#7EB6D9', '#F4A582', '#92C5A9', '#D4A5D0', '#F7DC6F', '#B0B0B0', '#E8927C', '#A8D8EA']
# Muted earth tones
COLORS_EARTH = ['#4E79A7', '#F28E2B', '#E15759', '#76B7B2', '#59A14F', '#EDC948', '#B07AA1', '#FF9DA7']
# High-contrast (use sparingly)
COLORS_CONTRAST = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f']
Sequential/Heatmap: Use 'viridis', 'magma', 'plasma'. Never use 'jet' or 'rainbow'.
Diverging: Use 'coolwarm' or 'RdBu_r' for positive/negative splits.
Chart-type code patterns
Grouped bar chart:
x = np.arange(len(categories))
width = 0.25
fig, ax = plt.subplots(figsize=(10, 6))
for i, (label, values) in enumerate(data_series.items()):
bars = ax.bar(x + i * width, values, width, label=label,
color=COLORS_PASTEL[i], edgecolor='black', linewidth=0.8)
ax.set_xticks(x + width * (len(data_series) - 1) / 2)
ax.set_xticklabels(categories)
ax.legend(loc='upper left', framealpha=0.9)
Line chart with markers and confidence bands:
fig, ax = plt.subplots(figsize=(10, 6))
for i, (label, y_vals) in enumerate(data_series.items()):
ax.plot(x_vals, y_vals, marker='o', markersize=6, linewidth=2,
color=COLORS_EARTH[i], label=label)
# Optional: confidence band
# ax.fill_between(x_vals, y_lower, y_upper, alpha=0.15, color=COLORS_EARTH[i])
ax.legend(loc='best', framealpha=0.9)
Heatmap with annotations:
fig, ax = plt.subplots(figsize=(8, 8))
im = ax.imshow(data_matrix, cmap='viridis', aspect='equal')
# Annotate cells
for i in range(data_matrix.shape[0]):
for j in range(data_matrix.shape[1]):
text_color = 'white' if data_matrix[i, j] > threshold else 'black'
ax.text(j, i, f'{data_matrix[i, j]:.2f}', ha='center', va='center',
color=text_color, fontsize=10)
plt.colorbar(im, ax=ax, shrink=0.8)
Radar/Spider chart:
angles = np.linspace(0, 2 * np.pi, len(categories), endpoint=False).tolist()
angles += angles[:1] # Close the polygon
fig, ax = plt.subplots(figsize=(8, 8), subplot_kw=dict(polar=True))
for i, (label, values) in enumerate(data_series.items()):
vals = values + values[:1]
ax.plot(angles, vals, linewidth=2, color=COLORS_EARTH[i], label=label)
ax.fill(angles, vals, alpha=0.15, color=COLORS_EARTH[i])
ax.set_xticks(angles[:-1])
ax.set_xticklabels(categories)
ax.legend(loc='upper right', bbox_to_anchor=(1.3, 1.1))
Code execution workflow
- Write the generated Python script to a
.pyfile using the Write tool - Execute the script using
python <script.py>via Bash - Check that the output
.pngfile was created successfully - If execution fails, read the error, fix the code, and re-execute (up to 3 attempts)
- Open the result image
Common pitfalls to avoid
- Never use
plt.show()— it blocks in headless mode - Always set
matplotlib.use('Agg')before importing pyplot - Always embed all data directly in the script; do not read external files unless the user explicitly provides a file path
- Avoid default matplotlib styling — always customize colors, fonts, and grid to avoid the "Veto Rule" of looking like unmodified default output
- Do not include figure titles/captions inside the plot (e.g., no
fig.suptitle("Figure 3: ...")) — captions belong in the paper, not the image - Handle tight layout — use
plt.tight_layout()beforesavefigto prevent label clipping - Use
bbox_inches='tight'insavefigto avoid whitespace - For bar charts with many categories, rotate x-labels 45° with
ha='right'
Stage 5: Critique and Refinement
After generating the initial output (XML for diagrams, or executing the Python script for plots), perform a self-critique:
For Diagram mode:
- Content fidelity: Does the diagram accurately reflect the methodology? Are all key components present?
- Text QA: Check for typos, unclear labels, nonsensical text
- Layout clarity: Is the flow clear? Is there visual clutter?
- Style compliance: Does it follow the academic style guide?
- Caption exclusion: Ensure no figure caption text appears inside the diagram
- Legend management: Remove redundant color legends if present
If issues are found, revise the XML and regenerate.
For Plot mode (4 evaluation dimensions from PaperBanana Critic Agent):
- Faithfulness: Does the plot correctly represent all data values? Are axis labels, legend entries, and annotations accurate? No fabricated data points or wrong chart types?
- Conciseness: No redundant labeling (e.g., both bar height AND text labels on many bars)? No unnecessary subplots? No text overload?
- Readability: Are axes labeled with units? Is text legible (no overlapping, sufficient contrast)? Are data series distinguishable? Legend present when needed? No data elements hidden behind legend?
- Aesthetics: Professional color scheme (not default matplotlib)? Consistent styling? No pixelation? No black background? No excessive 3D effects?
If issues are found, revise the Python code and re-execute.
Output workflow
Diagram mode
- Generate draw.io XML following the full pipeline above
- Write the XML to a
.drawiofile using the Write tool - If the user requested an export format (png, svg, pdf), export using the draw.io CLI with
--embed-diagram, then delete the source.drawiofile - Open the result
Plot mode
- Generate Python script following the full pipeline above
- Write the script to a
.pyfile using the Write tool - Execute the script via Bash:
python <script.py> - Verify the output
.pngfile exists - Open the result image
- Optionally, keep the
.pyfile for the user to modify later (do not delete by default)
Choosing the output format
Diagram format
/drawio-paper create a framework diagram->framework.drawio/drawio-paper png pipeline for my method->method-pipeline.drawio.png/drawio-paper svg: architecture overview->architecture-overview.drawio.svg
If no format is mentioned, write the .drawio file and open it.
Plot format
/drawio-paper plot a bar chart of model accuracy->model-accuracy.png+model-accuracy.py/drawio-paper plot pdf: training curve comparison->training-curve.pdf+training-curve.py/drawio-paper plot svg: ablation results->ablation-results.svg+ablation-results.py
Default output is .png at 300 DPI. For PDF/SVG, change the format parameter in plt.savefig().
Supported export formats
| Format | Embed XML | Notes |
|---|---|---|
png |
Yes (-e) |
Viewable everywhere, editable in draw.io |
svg |
Yes (-e) |
Scalable, editable in draw.io |
pdf |
Yes (-e) |
Printable, editable in draw.io |
draw.io CLI
Try drawio first, then fall back to platform-specific path:
- macOS:
/Applications/draw.io.app/Contents/MacOS/draw.io - Linux:
drawio - Windows:
"C:\Program Files\draw.io\draw.io.exe"
Export command
drawio -x -f <format> -e -b 10 -o <output> <input.drawio>
Key flags:
-x/--export: export mode-f/--format: output format (png, svg, pdf)-e/--embed-diagram: embed diagram XML in output-o/--output: output file path-b/--border: border width (default: 0)-s/--scale: scale diagram size
Opening the result
- macOS:
open <file> - Linux:
xdg-open <file> - Windows:
start <file>
File naming
- Use descriptive filenames based on content
- Lowercase with hyphens for multi-word names
- Diagrams: For export: double extensions (
name.drawio.png,name.drawio.svg). After successful export, delete the intermediate.drawiofile - Plots: Output
name.png(or.pdf/.svg) alongsidename.py(the source script). Keep both files
CRITICAL: XML well-formedness
- NEVER use double hyphens (
--) inside XML comments. Use single hyphens or rephrase. - Escape special characters in attribute values:
&,<,>," - Always use unique
idvalues for eachmxCell - Always set
html=1in style when using HTML formatting invalue
Common styles reference
| Property | Values | Use for |
|---|---|---|
rounded=1 |
0 or 1 | Rounded corners |
whiteSpace=wrap |
wrap | Text wrapping |
fillColor=#dae8fc |
Hex color | Background color |
strokeColor=#6c8ebf |
Hex color | Border color |
fontColor=#333333 |
Hex color | Text color |
shape=cylinder3 |
shape name | Database cylinders |
ellipse |
style keyword | Circles/ovals |
rhombus |
style keyword | Diamonds |
edgeStyle=orthogonalEdgeStyle |
style keyword | Right-angle connectors |
dashed=1 |
0 or 1 | Dashed lines |
swimlane |
style keyword | Titled containers |
group |
style keyword | Invisible containers |
container=1 |
0 or 1 | Enable container behavior |
pointerEvents=0 |
0 or 1 | Prevent container from capturing connections |
Edge routing
- Use
edgeStyle=orthogonalEdgeStylefor right-angle connectors - Space nodes generously (200px horizontal, 120px vertical gaps)
- Use
exitX/exitYandentryX/entryY(0-1) to control connection points - Add explicit waypoints when edges would overlap
- Use
rounded=1on edges for cleaner bends - Use
jettySize=autofor better port spacing
Containers and groups
Set parent="containerId" on child cells. Children use relative coordinates.
| Type | Style | When to use |
|---|---|---|
| Group (invisible) | group; |
No visual border needed |
| Swimlane (titled) | swimlane;startSize=30; |
Needs visible title bar |
| Custom container | Add container=1;pointerEvents=0; |
Any shape as container |
Always add pointerEvents=0; to container styles unless the container itself needs connections.
04 同仓库更多 Skills
workflow-skill-creator
Distills a completed user workflow or interaction into a reusable agent skill. Use when the user asks to turn their workflow, interaction, or multi-step process into a skill, or when they say "make this a skill", "create a skill from what we just did", "package this workflow" or similar. Do not use for creating skills from scratch without an existing workflow (use a generic skill-creator for that).
uv
Checks whether the uv Python package manager is installed and installs it if missing. Ensures uv is on PATH. Use when another skill requires uv as a prerequisite.
uniprot-database
Access protein metadata, function, taxonomy, and sequences across UniProtKB, UniParc, and UniRef. Use when searching for proteins, mapping identifiers, or retrieving functional annotations and publications. Don't use for sequence alignment, protein folding, or sequence similarity search (use specialized skills for those tasks).
unibind-database
Queries the UniBind database for experimentally validated transcription factor (TF) binding sites. Use when retrieving direct TF-DNA interaction datasets, downloading binding site coordinates (BED/FASTA) for local analysis, or listing available datasets by species, cell line, or TF name. Don't use to query specific intervals, locations, genes, motif models or expression data.
ucsc-conservation-and-tfbs
Fetch Evolutionary Conservation scores (phyloP, phastCons) and Transcription Factor Binding Sites (TFBS) from the UCSC Genome Browser. Use when analyzing whether genomic variants or regions are evolutionarily conserved, functionally important, or bounded by TF regulators across major projects (ENCODE, JASPAR, ReMap).
string-database
Query the STRING database for protein-protein interactions (PPIs), functional enrichment, and homology. Use when the user asks about interactions between specific proteins, interaction evidence, confidence scores, protein interaction partners, or pathway enrichments.