agentleFS
pengqianhanpengqianhan/open-paper-skills/skills/drawio-paper/SKILL.md

drawio-paper

Skill2 starsChanged 5 months agoMITView on GitHub

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.

  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

49 rules. About 0 are common, 28 are distinctive, and 21 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈28

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 21

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before generating diagrams or plots, ensure the PaperBananaBench reference dataset is available locally.

    line 16
  2. Very specific:

    Only requires curl and Python (stdlib zipfile), no git or git-lfs needed

    line 36
  3. Very specific:

    If the download fails due to network issues, retry or ask the user to manually download from …

    line 38
  4. Very specific:

    After setup, {skill_dir}/PaperBananaBench/diagram/ and {skill_dir}/PaperBananaBench/plot/ should each contain ref.json, test.json, and an …

    line 39
  5. Distinctive:

    Use when the user wants to create academic paper diagrams, such as:

    line 44
  6. Distinctive:

    Use when the user wants to create publication-quality statistical plots, such as:

    line 54
  7. Distinctive:

    If the user provides methodology text + figure caption → Diagram mode

    line 67
  8. Very specific:

    If the user provides raw data (table/JSON/CSV) + visual intent → Plot mode

    line 68
  9. Distinctive:

    If ambiguous, ask the user which mode they want

    line 69
  10. Distinctive:

    Follow this 5-stage pipeline to generate each visualization (diagram or plot).

    line 73
  11. Distinctive:

    Before generating, always look at reference images from the benchmark dataset to understand the visual style expected.

    line 77
  12. Very specific:

    Read the reference metadata from {skill_dir}/PaperBananaBench/diagram/ref.json and {skill_dir}/PaperBananaBench/diagram/test.json

    line 80
  13. Very specific:

    Use the Read tool to view the selected reference images from {skill_dir}/PaperBananaBench/diagram/images/

    line 82
  14. Distinctive:

    Create a detailed textual description of the diagram to generate, including:

    line 102
  15. Distinctive:

    All components and their relationships

    line 103
  16. Distinctive:

    Create a detailed textual description of the plot to generate, including:

    line 116
  17. Distinctive:

    All axis labels, tick values, and units

    line 120
  18. Distinctive:

    Icons: Use semantic icons (snowflake=frozen, fire=trainable, gear=processing)

    line 141
  19. Distinctive:

    Annotations: Prefer direct labeling over forcing legend references

    line 159
  20. Distinctive:

    Line charts: Always include geometric markers at data points.

    line 166
  21. Distinctive:

    Edge routing: Use orthogonalEdgeStyle with rounded=1 for clean bends

    line 235
  22. Distinctive:

    Use draw.io containers for logical grouping (stages, modules):

    line 240
  23. Distinctive:

    Use HTML formatting for mathematical symbols:

    line 256
  24. Very specific:

    Use Unicode/emoji characters in value attributes for semantic icons.

    line 265
  25. Distinctive:

    Required imports: Always include these at the top:

    line 409
  26. Very specific:

    Reset defaults: Always call plt.rcdefaults() before setting custom styles to avoid inheriting stale state.

    line 417
  27. Very specific:

    No interactive elements: Never use plt.show(). Always use plt.savefig() only.

    line 425
  28. Very specific:

    Sequential/Heatmap: Use 'viridis', 'magma', 'plasma'.

    line 477
  29. Very specific:

    Diverging: Use 'coolwarm' or 'RdBu_r' for positive/negative splits.

    line 479
  30. Distinctive:

    If execution fails, read the error, fix the code, and re-execute (up to 3 attempts)

    line 539
  31. Distinctive:

    After generating the initial output (XML for diagrams, or executing the Python script for plots), perform a self-critique:

    line 555
  32. Distinctive:

    Text QA: Check for typos, unclear labels, nonsensical text

    line 559
  33. Distinctive:

    Caption exclusion: Ensure no figure caption text appears inside the diagram

    line 562
  34. Distinctive:

    Legend management: Remove redundant color legends if present

    line 563
  35. Distinctive:

    If issues are found, revise the XML and regenerate.

    line 565
  36. Distinctive:

    Conciseness: No redundant labeling (e.g., both bar height AND text labels on many bars)?

    line 569
  37. Distinctive:

    If issues are found, revise the Python code and re-execute.

    line 573
  38. Very specific:

    If no format is mentioned, write the .drawio file and open it.

    line 598
  39. Very specific:

    Default output is .png at 300 DPI.

    line 605
  40. Distinctive:

    Use descriptive filenames based on content

    line 644
  41. Very specific:

    NEVER use double hyphens (--) inside XML comments: Use single hyphens or rephrase.

    line 651
  42. Very specific:

    Always use unique id values for each mxCell

    line 653
  43. Very specific:

    Always set html=1 in style when using HTML formatting in value

    line 654
  44. Very specific:

    Use edgeStyle=orthogonalEdgeStyle for right-angle connectors

    line 677
  45. Very specific:

    Use exitX/exitY and entryX/entryY (0-1) to control connection points

    line 679
  46. Distinctive:

    Add explicit waypoints when edges would overlap

    line 680
  47. Very specific:

    Use rounded=1 on edges for cleaner bends

    line 681
  48. Very specific:

    Use jettySize=auto for better port spacing

    line 682
  49. Very specific:

    Always add pointerEvents=0.

    line 694

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
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 .drawio diagrams 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 curl and Python (stdlib zipfile), no git or git-lfs needed
  • Python extraction is used instead of unzip to 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 contain ref.json, test.json, and an images/ 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:

  1. Read the reference metadata from {skill_dir}/PaperBananaBench/diagram/ref.json and {skill_dir}/PaperBananaBench/diagram/test.json
  2. Based on the user's topic (domain) and visual intent (diagram type), select 3-5 relevant reference images to study
  3. Use the Read tool to view the selected reference images from {skill_dir}/PaperBananaBench/diagram/images/
  4. Note the visual patterns: layout structure, color schemes, grouping strategies, icon usage, arrow styles

For Plot mode:

  1. Read the reference metadata from {skill_dir}/PaperBananaBench/plot/ref.json and {skill_dir}/PaperBananaBench/plot/test.json
  2. Based on the user's data type and desired plot type, select 3-5 relevant reference plot images to study
  3. Use the Read tool to view the selected reference images from {skill_dir}/PaperBananaBench/plot/images/
  4. 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):

  1. 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
  2. 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):

  1. 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
  2. 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

PurposeColorHex
Background zone - bluePale Ice Blue#E6F3FF
Background zone - greenPale Mint#E0F2F1
Background zone - purplePale Lavender#F3E5F5
Background zone - warmCream/Beige#FFF8E1
Active module - blueSoft Blue#DAE8FC
Active module - greenSoft Green#D5E8D4
Active module - orangeSoft Orange#FFE6CC
Active module - pinkSoft Pink#F8CECC
Frozen/static elementLight Grey#F5F5F5
Highlight/outputGold accent#FFF2CC
Trainable elementWarm tone#FFE0B2
Frozen elementCool grey#E0E0E0
Border - blueMedium Blue#6C8EBF
Border - greenMedium Green#82B366
Border - orangeMedium Orange#D6B656
Border - redMedium 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="&lt;i&gt;L&lt;/i&gt; = &amp;sum; &lt;i&gt;L&lt;/i&gt;&lt;sub&gt;i&lt;/sub&gt;" 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="&#10052;" 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

IconEmojiHTML EntityMeaningUsage
Snowflake❄&#10052;Frozen / Non-trainableFrozen encoder, fixed weights
Fire🔥&#128293;Trainable / Active learningFine-tuning layers, trainable heads
Lightning⚡&#9889;Fast / AcceleratedEfficient inference, speedup
Lock🔒&#128274;Locked / ProtectedFrozen parameters, access control
Unlock🔓&#128275;Unlocked / ReleasedUnfrozen for training
Stop sign🛑&#128721;Stopped / BlockedNon-trainable, gradient stop

Agents & Roles

IconEmojiHTML EntityMeaningUsage
Robot🤖&#129302;AI Agent / ModelLLM agent, autonomous module
Person👤&#128100;User / HumanHuman input, user query
People👥&#128101;Multi-user / CrowdCollaborative systems, multi-user
Brain🧠&#129504;Reasoning / IntelligenceLLM core, reasoning module
Thinking🤔&#129488;Evaluation / CritiqueCritic agent, reviewer
Detective🕵&#128373;Investigation / AnalysisAnomaly detection, inspection
Teacher👨‍🏫&#128104;&#8205;&#127979;Teaching / SupervisionTeacher model, supervisor
Student👨‍🎓&#128104;&#8205;&#127891;Learning / StudentStudent model, distillation target

Data & Content

IconEmojiHTML EntityMeaningUsage
Document📄&#128196;Text / DocumentInput text, paper, prompt
Clipboard📋&#128203;Plan / ListStructured plan, task list
Folder📁&#128193;Dataset / CollectionData directory, file collection
File cabinet🗃&#128451;Storage / ArchiveKnowledge base, data store
Database🗄&#128452;Database / RepositoryVector DB, model repository
Image🖼&#128444;Image / Visual dataImage input, visual features
Speech💬&#128172;Chat / DialoguePrompt, conversation, chat bubble
Label🏷&#127991;Tag / AnnotationClass label, metadata tag
Book📚&#128218;Knowledge / CorpusTraining corpus, reference library
Newspaper📰&#128240;Article / ReportPaper, news, generated report

Operations & Processing

IconEmojiHTML EntityMeaningUsage
Gear⚙&#9881;Processing / ComputationModel inference, computation
Magnifier🔍&#128269;Search / RetrievalRetrieval, attention, inspection
Wrench🔧&#128295;Configuration / TuningHyperparameter tuning, adjustment
Scissors✂&#9986;Pruning / CuttingModel pruning, token trimming
Filter🔽&#128317;Filtering / SelectionFeature selection, data filtering
Shuffle🔀&#128256;Random / ShuffleData augmentation, random sampling
Cycle🔄&#128260;Loop / IterationIterative refinement, feedback loop
Link🔗&#128279;Connection / LinkingCross-attention, entity linking
Merge🔀&#128256;Merge / CombineFeature fusion, model merging

Evaluation & Results

IconEmojiHTML EntityMeaningUsage
Checkmark✅&#9989;Pass / CorrectCorrect prediction, quality pass
Cross❌&#10060;Fail / IncorrectWrong prediction, rejected
Trophy🏆&#127942;Best / WinnerBest model, SOTA result
Chart up📈&#128200;Improvement / GrowthPerformance gain, metric increase
Chart down📉&#128201;Decline / DegradationPerformance drop, quality loss
Target🎯&#127919;Goal / ObjectiveTarget task, loss objective
Star⭐&#11088;Highlight / Key resultKey contribution, important
Warning⚠&#9888;Caution / IssuePotential problem, limitation

Domain-Specific

IconEmojiHTML EntityMeaningUsage
Eye👁&#128065;Vision / ObservationVisual encoder, image perception
Ear👂&#128066;Audio / ListeningSpeech recognition, audio input
Pen✍&#9997;Writing / GenerationText generation, authoring
Globe🌐&#127760;Web / GlobalInternet retrieval, world knowledge
DNA🧬&#129516;Biology / SequenceProtein, genomics, molecular
Atom⚛&#9883;Physics / ScienceScientific computing, simulation
Microscope🔬&#128300;Research / AnalysisDetailed analysis, micro-level
Telescope🔭&#128301;Far-sighted / OverviewMacro-level, global view
Pill💊&#128138;Medical / DrugDrug discovery, medical AI
Tree🌳&#127795;Tree structure / HierarchyDecision tree, parse tree
Network🕸&#128376;Graph / NetworkNeural network, knowledge graph
Dice🎲&#127922;Random / StochasticSampling, probability, noise
Thermometer🌡&#127777;TemperatureSoftmax temperature, scaling
Hourglass⏳&#9203;Time / TemporalTime series, sequence, latency
Layer📊&#128202;Layers / StackModel layers, feature maps
Key🔑&#128273;Key / AuthenticationAttention key, API key, decryption
Light bulb💡&#128161;Idea / InsightInnovation, key finding
Rocket🚀&#128640;Launch / DeployModel deployment, fast execution
Shield🛡&#128737;Defense / ProtectionAdversarial defense, safety
Sword⚔&#9876;Attack / AdversarialAdversarial attack, red-teaming

Mathematical Operators (use with fontFamily=Times New Roman)

SymbolNameHTML EntityUsage
⊕Circled plus&#8853;Element-wise addition, concatenation
⊗Circled times&#8855;Element-wise multiplication, outer product
⊙Circled dot&#8857;Hadamard product, dot product
∑Summation&#8721;Sum, aggregation
∏Product&#8719;Product operation
→Right arrow&#8594;Mapping, transformation
↔Left-right arrow&#8596;Bidirectional, mutual
σSigma&#963;Sigmoid, activation
∇Nabla&#8711;Gradient
∞Infinity&#8734;Unbounded, continuous
∈Element of&#8712;Membership, belongs to
≈Approximately&#8776;Approximation
∥Parallel&#8741;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="&#8853;" 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

  1. 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).
  2. 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
  1. Reset defaults: Always call plt.rcdefaults() before setting custom styles to avoid inheriting stale state.
  2. 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')
  1. No interactive elements: Never use plt.show(). Always use plt.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

  1. Write the generated Python script to a .py file using the Write tool
  2. Execute the script using python <script.py> via Bash
  3. Check that the output .png file was created successfully
  4. If execution fails, read the error, fix the code, and re-execute (up to 3 attempts)
  5. 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() before savefig to prevent label clipping
  • Use bbox_inches='tight' in savefig to 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:

  1. Content fidelity: Does the diagram accurately reflect the methodology? Are all key components present?
  2. Text QA: Check for typos, unclear labels, nonsensical text
  3. Layout clarity: Is the flow clear? Is there visual clutter?
  4. Style compliance: Does it follow the academic style guide?
  5. Caption exclusion: Ensure no figure caption text appears inside the diagram
  6. 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):

  1. 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?
  2. Conciseness: No redundant labeling (e.g., both bar height AND text labels on many bars)? No unnecessary subplots? No text overload?
  3. 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?
  4. 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

  1. Generate draw.io XML following the full pipeline above
  2. Write the XML to a .drawio file using the Write tool
  3. If the user requested an export format (png, svg, pdf), export using the draw.io CLI with --embed-diagram, then delete the source .drawio file
  4. Open the result

Plot mode

  1. Generate Python script following the full pipeline above
  2. Write the script to a .py file using the Write tool
  3. Execute the script via Bash: python <script.py>
  4. Verify the output .png file exists
  5. Open the result image
  6. Optionally, keep the .py file 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

FormatEmbed XMLNotes
pngYes (-e)Viewable everywhere, editable in draw.io
svgYes (-e)Scalable, editable in draw.io
pdfYes (-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 .drawio file
  • Plots: Output name.png (or .pdf/.svg) alongside name.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: &amp;, &lt;, &gt;, &quot;
  • Always use unique id values for each mxCell
  • Always set html=1 in style when using HTML formatting in value

Common styles reference

PropertyValuesUse for
rounded=10 or 1Rounded corners
whiteSpace=wrapwrapText wrapping
fillColor=#dae8fcHex colorBackground color
strokeColor=#6c8ebfHex colorBorder color
fontColor=#333333Hex colorText color
shape=cylinder3shape nameDatabase cylinders
ellipsestyle keywordCircles/ovals
rhombusstyle keywordDiamonds
edgeStyle=orthogonalEdgeStylestyle keywordRight-angle connectors
dashed=10 or 1Dashed lines
swimlanestyle keywordTitled containers
groupstyle keywordInvisible containers
container=10 or 1Enable container behavior
pointerEvents=00 or 1Prevent container from capturing connections

Edge routing

  • Use edgeStyle=orthogonalEdgeStyle for right-angle connectors
  • Space nodes generously (200px horizontal, 120px vertical gaps)
  • Use exitX/exitY and entryX/entryY (0-1) to control connection points
  • Add explicit waypoints when edges would overlap
  • Use rounded=1 on edges for cleaner bends
  • Use jettySize=auto for better port spacing

Containers and groups

Set parent="containerId" on child cells. Children use relative coordinates.

TypeStyleWhen to use
Group (invisible)group;No visual border needed
Swimlane (titled)swimlane;startSize=30;Needs visible title bar
Custom containerAdd container=1;pointerEvents=0;Any shape as container

Always add pointerEvents=0; to container styles unless the container itself needs connections.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.