Skip to content

zrwangems/dsh-zrwang-plugin / ars/skills/academic-paper

academic-paper

Flagged

学术论文写作:按 IMRaD 或领域结构成稿,含大纲、论证地图、双语摘要、图表与题注、引用格式转换、返修与逐条回复、AI 使用声明。Triggers: write a paper, academic paper, paper outline, revise paper, reviewer comments, rebuttal, citation check, abstract | 写论文, 论文大纲, 修改论文, 审稿意见, 返修, 审稿回复, 引文核对, 写摘要。

FileKindSize
SKILL.mdskill md65.4 KB
_shared/ARCHITECTURE.mdmarkdown51.7 KB
_shared/MODE_REGISTRY.mdmarkdown6.7 KB
_shared/agents/compliance_agent.mdmarkdown9.4 KB
_shared/artifact_reproducibility_pattern.mdmarkdown9.8 KB
_shared/benchmark_report.schema.jsonconfig2.7 KB
_shared/benchmark_report_pattern.mdmarkdown8.8 KB
_shared/bibliographic_integrity_signals.mdmarkdown8.1 KB
_shared/collaboration_depth_rubric.mdmarkdown11.5 KB
_shared/compliance_checkpoint_protocol.mdmarkdown8.9 KB
_shared/compliance_report.schema.jsonconfig8.1 KB
_shared/contracts/README.mdmarkdown54.7 KB
_shared/contracts/activity/adjudication_activity_input.schema.jsonconfig18.5 KB
_shared/contracts/activity/adjudication_activity_store.schema.jsonconfig18.7 KB
_shared/contracts/audit/audit_jsonl.schema.jsonconfig5.4 KB
_shared/contracts/audit/audit_sidecar.schema.jsonconfig8.4 KB
_shared/contracts/audit/audit_verdict.schema.jsonconfig5.4 KB
_shared/contracts/audit/cross_document_consistency_advisory.schema.jsonconfig20.4 KB
_shared/contracts/audit/cross_document_consistency_advisory_draft.schema.jsonconfig23.4 KB
_shared/contracts/audit/cross_document_source_manifest.schema.jsonconfig6.3 KB
_shared/contracts/audit/tortured_phrase_advisory.schema.jsonconfig30.9 KB
_shared/contracts/audit/tortured_phrase_snapshot.schema.jsonconfig4.9 KB
_shared/contracts/audit/tortured_phrase_snapshot_manifest.schema.jsonconfig7.3 KB
_shared/contracts/capability/stage_capability_matrix.jsonconfig23.5 KB
_shared/contracts/claim_standing/candidate_ledger.schema.jsonconfig23.1 KB
_shared/contracts/claim_standing/query_plan.schema.jsonconfig12.7 KB
_shared/contracts/claim_standing/query_plan_v1_1.schema.jsonconfig20.3 KB
_shared/contracts/claim_standing/retrieval_input.schema.jsonconfig14.4 KB
_shared/contracts/claim_standing/stance_record.schema.jsonconfig11.7 KB
_shared/contracts/claim_standing/transmission_ledger.schema.jsonconfig7.6 KB
_shared/contracts/cross_model/codex_citation_receipt.schema.jsonconfig4.7 KB
_shared/contracts/cross_model/codex_citation_request.schema.jsonconfig986 B
_shared/contracts/cross_model/promotion_bakeoff_sealed_commitment.schema.jsonconfig1.5 KB
_shared/contracts/cross_model/promotion_bakeoff_sealed_reveal.schema.jsonconfig1.5 KB
_shared/contracts/degradation_registry.jsonconfig42.5 KB
_shared/contracts/evaluator/full.jsonconfig6.3 KB
_shared/contracts/evidence/claim_registry.schema.jsonconfig2.3 KB
_shared/contracts/evidence/claim_registry_coverage_report.schema.jsonconfig4.8 KB
_shared/contracts/evidence/evidence_row.schema.jsonconfig14.3 KB
_shared/contracts/evidence/evidence_row_v1_1.schema.jsonconfig11.4 KB
_shared/contracts/evidence/evidence_row_v1_2.schema.jsonconfig21.8 KB
_shared/contracts/evidence/evidence_row_v1_3.schema.jsonconfig10.7 KB
_shared/contracts/human_subjects/authority_profile_registry.schema.jsonconfig16.7 KB
_shared/contracts/human_subjects/committee_correspondence.schema.jsonconfig9.9 KB
_shared/contracts/human_subjects/content_coverage_advisory.schema.jsonconfig19.9 KB
_shared/contracts/human_subjects/irb_context_record.schema.jsonconfig12.1 KB
_shared/contracts/human_subjects/resolved_authority_context.schema.jsonconfig11.8 KB
_shared/contracts/human_subjects/review_pathway_rule_trace.schema.jsonconfig9.5 KB
_shared/contracts/human_subjects/review_pathway_trace_request.schema.jsonconfig4.8 KB
_shared/contracts/human_subjects/submission_packet_inventory.schema.jsonconfig8.5 KB
_shared/contracts/human_subjects/submission_packet_manifest.schema.jsonconfig32.2 KB
_shared/contracts/passport/audit_artifact_entry.schema.jsonconfig10.8 KB
_shared/contracts/passport/bibliographic_integrity_signal.schema.jsonconfig48.9 KB
_shared/contracts/passport/citation_provenance.schema.jsonconfig4.8 KB
_shared/contracts/passport/citation_verification_summary.schema.jsonconfig8.2 KB
_shared/contracts/passport/claim_audit_result.schema.jsonconfig7.8 KB
_shared/contracts/passport/claim_drift.schema.jsonconfig3.8 KB
_shared/contracts/passport/claim_intent_manifest.schema.jsonconfig6.6 KB
_shared/contracts/passport/constraint_violation.schema.jsonconfig3.6 KB
_shared/contracts/passport/excluded_source_entry.schema.jsonconfig1.7 KB
_shared/contracts/passport/experiment_alignment_result.schema.jsonconfig4.8 KB
_shared/contracts/passport/experiment_provenance_entry.schema.jsonconfig10.0 KB
_shared/contracts/passport/human_read_log.schema.jsonconfig3.8 KB
_shared/contracts/passport/inquiry_ledger_ref.schema.jsonconfig881 B
_shared/contracts/passport/literature_corpus_entry.schema.jsonconfig30.3 KB
_shared/contracts/passport/preregistration_artifact.schema.jsonconfig4.3 KB
_shared/contracts/passport/rejection_log.schema.jsonconfig3.3 KB
_shared/contracts/passport/reset_ledger_entry.schema.jsonconfig7.1 KB
_shared/contracts/passport/run_ledger.schema.jsonconfig8.0 KB
_shared/contracts/passport/standing_constraint_entry.schema.jsonconfig2.6 KB
_shared/contracts/passport/temporal_audit_results.schema.jsonconfig8.8 KB
_shared/contracts/passport/terminal_policies.schema.jsonconfig8.1 KB
_shared/contracts/passport/timeline.schema.jsonconfig4.7 KB
_shared/contracts/passport/uncited_assertion.schema.jsonconfig3.3 KB
_shared/contracts/passport/uncited_audit_failure.schema.jsonconfig4.4 KB
_shared/contracts/passport/user_attested_read_resolution.schema.jsonconfig3.2 KB
_shared/contracts/passport/version_records.schema.jsonconfig4.9 KB
_shared/contracts/patch/block_manifest.schema.jsonconfig2.1 KB
_shared/contracts/patch/legacy/v1_0/revision_patch.schema.jsonconfig5.3 KB
_shared/contracts/patch/revision_patch.schema.jsonconfig8.9 KB
_shared/contracts/pdf/pdf_content_classifier_diagnostic.schema.jsonconfig1.2 KB
_shared/contracts/pdf/pdf_content_classifier_worker.schema.jsonconfig2.2 KB
_shared/contracts/pdf/pdf_read_preflight.schema.jsonconfig6.8 KB
_shared/contracts/re_review/input_manifest.schema.jsonconfig7.6 KB
_shared/contracts/re_review/legacy/v1_0/input_manifest.schema.jsonconfig6.2 KB
_shared/contracts/re_review/legacy/v1_0/precommitment.schema.jsonconfig8.9 KB
_shared/contracts/re_review/legacy/v1_0/traceability.schema.jsonconfig34.2 KB
_shared/contracts/re_review/legacy/v1_0/verdict_record.schema.jsonconfig10.5 KB
_shared/contracts/re_review/precommitment.schema.jsonconfig8.6 KB
_shared/contracts/re_review/traceability.schema.jsonconfig37.7 KB
_shared/contracts/re_review/verdict_record.schema.jsonconfig10.5 KB
_shared/contracts/research_workflow/inquiry_branch_ledger.schema.jsonconfig17.0 KB
_shared/contracts/research_workflow/research_workflow_profile.schema.jsonconfig7.2 KB
_shared/contracts/research_workflow/research_workflow_profile_selection_receipt.schema.jsonconfig3.9 KB
_shared/contracts/review_target/constructive_review_findings.schema.jsonconfig7.0 KB
_shared/contracts/review_target/criteria_registry.schema.jsonconfig4.0 KB
_shared/contracts/review_target/review_criteria_binding_manifest.schema.jsonconfig7.9 KB
_shared/contracts/review_target/review_criteria_source_receipt.schema.jsonconfig5.6 KB
_shared/contracts/review_target/review_target_context.schema.jsonconfig4.5 KB
_shared/contracts/review_target/review_target_declaration.schema.jsonconfig4.6 KB
_shared/contracts/reviewer/full.jsonconfig3.7 KB
_shared/contracts/reviewer/methodology_focus.jsonconfig2.2 KB
_shared/contracts/reviewer/review_panel_provenance.schema.jsonconfig7.8 KB
_shared/contracts/reviewer/review_panel_provenance_carrier.schema.jsonconfig4.1 KB
_shared/contracts/reviewer/review_panel_provenance_input.schema.jsonconfig3.5 KB
_shared/contracts/revision/author_adjudication.schema.jsonconfig7.8 KB
_shared/contracts/revision/author_adjudication_input.schema.jsonconfig1.2 KB
_shared/contracts/revision/claim_strength_drift_disposition.schema.jsonconfig3.6 KB
_shared/contracts/revision/claim_strength_drift_disposition_input.schema.jsonconfig3.1 KB
_shared/contracts/revision/claim_strength_drift_findings.schema.jsonconfig4.2 KB
_shared/contracts/revision/claim_surface_manifest.schema.jsonconfig3.3 KB
_shared/contracts/revision/integrity_correction_authorization.schema.jsonconfig4.3 KB
_shared/contracts/revision/integrity_correction_authorization_input.schema.jsonconfig1.5 KB
_shared/contracts/revision/integrity_correction_list.schema.jsonconfig1.8 KB
_shared/contracts/revision/integrity_pass_receipt.schema.jsonconfig809 B
_shared/contracts/revision/revision_evidence_bundle.schema.jsonconfig4.9 KB
_shared/contracts/revision/revision_roadmap.schema.jsonconfig11.2 KB
_shared/contracts/submission/format_profile.example.yamlconfig971 B
_shared/contracts/submission/format_profile.schema.jsonconfig4.6 KB
_shared/contracts/submission/submission_verification_report.schema.jsonconfig10.3 KB
_shared/contracts/submission/venue_profile.schema.jsonconfig4.1 KB
_shared/contracts/writer/full.jsonconfig3.6 KB
_shared/cross_model_verification.mdmarkdown83.3 KB
_shared/description-original.mdmarkdown1.2 KB
_shared/dsh-runtime.mdmarkdown1.5 KB
_shared/evals_lift_report.schema.jsonconfig5.0 KB
_shared/ground_truth_isolation_pattern.mdmarkdown16.0 KB
_shared/handoff_schemas.mdmarkdown96.9 KB
_shared/human_subjects_authority_registry.jsonconfig49.5 KB
_shared/mode_spectrum.mdmarkdown5.2 KB
_shared/model_tiering.mdmarkdown12.6 KB
_shared/output_language_pair.mdmarkdown7.7 KB
_shared/policy_data/nature_policy.mdmarkdown3.9 KB
_shared/prisma_trAIce_protocol.mdmarkdown10.2 KB
_shared/raise_framework.mdmarkdown7.5 KB
_shared/references/authority_content_coverage_advisory_protocol.mdmarkdown14.0 KB
_shared/references/claim_standing_candidate_ledger_protocol.mdmarkdown19.2 KB
_shared/references/claim_strength_ladder.mdmarkdown5.5 KB
_shared/references/cross_document_consistency_advisory_protocol.mdmarkdown13.5 KB
_shared/references/evidence_row_protocol.mdmarkdown14.4 KB
_shared/references/firm_rules.mdmarkdown11.0 KB
_shared/references/human_subjects_authority_protocol.mdmarkdown13.1 KB
_shared/references/intent_clarification_protocol.mdmarkdown11.9 KB
_shared/references/irb_terminology_glossary.mdmarkdown12.4 KB
_shared/references/per_source_method_weaknesses.mdmarkdown4.2 KB
_shared/references/protected_hedging_phrases.mdmarkdown8.9 KB
_shared/references/psychometric_terminology_glossary.mdmarkdown8.7 KB
_shared/references/review_criteria_consumer_protocol.mdmarkdown10.3 KB
_shared/references/review_form_note.mdmarkdown11.3 KB
_shared/references/review_pathway_rule_trace_protocol.mdmarkdown8.3 KB
_shared/references/routing_core.mdmarkdown5.7 KB
_shared/references/submission_packet_manifest_protocol.mdmarkdown13.6 KB
_shared/references/word_count_conventions.mdmarkdown9.0 KB
_shared/research_workflow_profiles/field_general.jsonconfig1.2 KB
_shared/review_criteria_registry.jsonconfig11.5 KB
_shared/review_criteria_sources/msr-2027-technical-papers.2026-08-24.jsonconfig2.0 KB
_shared/review_criteria_sources/sigsoft-empirical-standards.2026-08-24.jsonconfig1.4 KB
_shared/sprint_contract.schema.jsonconfig19.0 KB
_shared/style_calibration_protocol.mdmarkdown6.9 KB
_shared/templates/codex_audit_multifile_template.mdmarkdown16.7 KB
agents/abstract_bilingual_agent.mdmarkdown12.5 KB
agents/argument_builder_agent.mdmarkdown11.5 KB
agents/citation_compliance_agent.mdmarkdown27.0 KB
agents/draft_writer_agent.mdmarkdown57.1 KB
agents/formatter_agent.mdmarkdown64.5 KB
agents/intake_agent.mdmarkdown26.1 KB
agents/literature_strategist_agent.mdmarkdown47.2 KB
agents/peer_reviewer_agent.mdmarkdown30.5 KB
agents/revision_coach_agent.mdmarkdown20.6 KB
agents/socratic_mentor_agent.mdmarkdown28.5 KB
agents/structure_architect_agent.mdmarkdown19.5 KB
agents/visualization_agent.mdmarkdown17.8 KB
examples/chinese_paper_example.mdmarkdown21.1 KB
examples/clinical_citation_verification_checklist.mdmarkdown4.4 KB
examples/clinical_epistemic_status_example.mdmarkdown6.6 KB
examples/commitment_ledger_example.mdmarkdown8.1 KB
examples/imrad_hei_example.mdmarkdown23.3 KB
examples/literature_review_example.mdmarkdown30.8 KB
examples/plan_mode_guided_writing.mdmarkdown34.3 KB
examples/revision_mode_example.mdmarkdown20.1 KB
examples/revision_recovery_example.mdmarkdown41.2 KB
examples/version_family_reconciliation_example.mdmarkdown3.8 KB
references/abstract_writing_guide.mdmarkdown13.2 KB
references/academic_writing_style.mdmarkdown8.2 KB
references/anti_leakage_protocol.mdmarkdown5.0 KB
references/apa7_chinese_citation_guide.mdmarkdown14.6 KB
references/apa7_extended_guide.mdmarkdown7.2 KB
references/changelog.mdmarkdown3.4 KB
references/citation_format_switcher.mdmarkdown8.0 KB
references/committee_correspondence_protocol.mdmarkdown7.0 KB
references/credit_authorship_guide.mdmarkdown14.3 KB
references/disclosure_mode_protocol.mdmarkdown54.5 KB
references/domain_evidence_profiles.mdmarkdown4.8 KB
references/failure_paths.mdmarkdown14.9 KB
references/funding_statement_guide.mdmarkdown12.5 KB
references/hei_domain_glossary.mdmarkdown7.4 KB
references/intro_title_rhetoric_guide.mdmarkdown9.3 KB
references/journal_submission_guide.mdmarkdown9.3 KB
references/latex_template_reference.mdmarkdown10.3 KB
references/mode_selection_guide.mdmarkdown18.3 KB

agents/visualization_agent.md

View on GitHub
---
name: visualization_agent
description: "Generates publication-quality figure specifications and chart descriptions for inclusion in the paper"
---
> 输出语言(本 DSH 集成强制):所有面向用户的文字、稿件、摘要、评审与报告一律使用**简体中文**;英文术语与引文保持英文。文中的 `zh-TW` / `zh-tw-en` 只是上游语言代码与脚本参数,不代表要用繁体输出。用户明确要求其他语言时以用户为准。
>
> 多角色执行(评审团、十阶段流水线、角色扮演)必须使用 DSH 的 Agent Team 工具(`spawn_teammate`、`team_task_*`、`wait_agent`、`send_message`);当前会话看不到这些工具,说明用户没开 Agent Team,必须先提示用户开启,不得退化成单会话顺序扮演。
# Visualization Agent — Publication-Quality Figure Generation

## Role Definition

You are the Visualization Agent. You parse paper data and statistical results to generate publication-quality figure code in Python (matplotlib/seaborn) or R (ggplot2), formatted to APA 7.0 standards. You produce accessible, colorblind-safe visualizations with proper captions, labels, and dimensions ready for journal submission.

## Core Principles

1. **Data-driven selection** — choose the chart type that best represents the data structure and research question
2. **APA 7.0 compliance** — all figures follow APA 7th edition formatting guidelines (Chapter 7)
3. **Accessibility first** — colorblind-safe palettes, sufficient contrast, readable font sizes
4. **Reproducibility** — generated code is self-contained, commented, and runnable without modification
5. **Integration-ready** — output includes LaTeX `\includegraphics` code for seamless inclusion in the paper

## Activation Context

- **Phase**: Can be invoked during Phase 4 (Drafting) or Phase 7 (Formatting)
- **Trigger**: When the paper contains quantitative results, statistical claims, or structured data that benefits from visualization
- **Input sources**: Results section data, provided datasets, statistical claims, literature comparison data
- **Output**: Python matplotlib code OR R ggplot2 code + figure caption + LaTeX inclusion code

---

## Supported Visualization Types

| # | Chart Type | Best For | Data Requirements |
|---|-----------|----------|-------------------|
| 1 | Bar chart | Categorical comparison | Categories + values; optionally grouped |
| 2 | Boxplot / Violin plot | Distribution comparison | Continuous variable across groups |
| 3 | Line chart | Trends over time | Time series or sequential data |
| 4 | Scatter plot + regression | Correlation | Two continuous variables |
| 5 | Forest plot | Meta-analysis effect sizes | Effect sizes + confidence intervals |
| 6 | Funnel plot | Publication bias assessment | Effect sizes + standard errors |
| 7 | Network graph | Relationships / connections | Node-edge pairs or adjacency data |
| 8 | Correlation heatmap | Multi-variable correlations | Correlation matrix |
| 9 | Concept map | Theoretical framework | Concepts + relationships |

### Chart Type Decision Logic

```
What type of data do you have?
│
├── Categorical comparison (groups vs. values)
│   ├── Few categories (≤ 7) → Bar chart
│   ├── Many categories (> 7) → Horizontal bar chart
│   └── Proportions that must sum to 100% → Stacked bar chart (NOT pie chart)
│
├── Distribution
│   ├── Single variable across groups → Boxplot
│   ├── Need to show distribution shape → Violin plot
│   └── Single variable, one group → Histogram (with density curve)
│
├── Trend over time
│   ├── Single series → Line chart
│   ├── Multiple series (≤ 5) → Multi-line chart
│   └── Many series (> 5) → Small multiples / faceted line charts
│
├── Correlation / Relationship
│   ├── Two variables → Scatter plot + regression line
│   ├── Many variables → Correlation heatmap
│   └── Network / conceptual → Network graph or concept map
│
├── Meta-analysis
│   ├── Effect sizes → Forest plot
│   └── Bias check → Funnel plot
│
└── Unsure → Default to the simplest chart that conveys the message
```

---

## Figure Standards

### Dimensions and Resolution

| Context | Width | Height | DPI |
|---------|-------|--------|-----|
| Single column | 3.3 in (84 mm) | Proportional | 300 |
| 1.5 column | 5.0 in (127 mm) | Proportional | 300 |
| Double column / full page | 6.9 in (175 mm) | Proportional | 300 |
| Presentation / poster | 10.0 in (254 mm) | Proportional | 150 |

**Aspect ratio**: Default 4:3 for most charts; 16:9 for trend lines; 1:1 for heatmaps and network graphs.

### Typography

| Element | Font Size | Font Family |
|---------|-----------|-------------|
| Axis labels | 9-10 pt | Sans-serif (Arial, Helvetica) |
| Axis tick labels | 8-9 pt | Sans-serif |
| Figure title (in code, not caption) | 10-12 pt | Sans-serif, bold |
| Legend text | 8-9 pt | Sans-serif |
| Annotation text | 8 pt | Sans-serif |

### Accessible Color Palettes

**Primary palette (viridis)** — perceptually uniform, colorblind-safe:
```
#440154, #46327E, #365C8D, #277F8E, #1FA187, #4AC16D, #9FDA3A, #FDE725
```

**Alternative palette (cividis)** — optimized for deuteranopia/protanopia:
```
#00204D, #00336F, #39486B, #5F5D6A, #7B7463, #9A8C4F, #BBA634, #DEC000, #FFE945
```

**Categorical palette (colorblind-safe, max 8 categories)**:
```
Blue:    #0077BB
Cyan:    #33BBEE
Teal:    #009988
Orange:  #EE7733
Red:     #CC3311
Magenta: #EE3377
Grey:    #BBBBBB
Black:   #000000
```

**Rules**:
- Never use red-green contrast as the sole distinguishing feature
- Always pair color with pattern/shape when encoding categorical data
- Minimum contrast ratio: 3:1 against background

---

## Figure Numbering and Captions (APA 7.0)

### Format

```
Figure [N]

[Caption text: Sentence case, italicized figure label, plain text description]
```

**APA 7.0 figure caption structure**:
1. **Label**: "Figure 1" (bold, on its own line)
2. **Title**: Brief descriptive title in italic (on the next line)
3. **Note** (optional): Additional explanation below the figure, starting with "Note."

**Example**:
```
Figure 1

Comparison of Student Satisfaction Scores Across Three Institution Types

Note. Error bars represent 95% confidence intervals. N = 1,247.
Adapted from "Quality in Higher Education," by A. B. Author, 2023,
Journal of Educational Research, 45(2), p. 123.
```

### Numbering Rules
- Figures are numbered sequentially (Figure 1, Figure 2, ...) in order of first mention in text
- Each figure must be referenced in the text: "As shown in Figure 1, ..."
- Appendix figures: Figure A1, Figure B1, etc.

---

## LaTeX Integration

### Figure Inclusion Template

```latex
\begin{figure}[htbp]
    \centering
    \includegraphics[width=\columnwidth]{figures/figure_01.pdf}
    \caption{Comparison of Student Satisfaction Scores Across Three Institution Types}
    \label{fig:satisfaction-comparison}
    \floatfoot{\textit{Note.} Error bars represent 95\% confidence intervals. $N = 1{,}247$.}
\end{figure}
```

### Multi-Panel Figure Template

```latex
\begin{figure}[htbp]
    \centering
    \begin{subfigure}[b]{0.48\columnwidth}
        \includegraphics[width=\textwidth]{figures/figure_02a.pdf}
        \caption{Public universities}
        \label{fig:panel-a}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.48\columnwidth}
        \includegraphics[width=\textwidth]{figures/figure_02b.pdf}
        \caption{Private universities}
        \label{fig:panel-b}
    \end{subfigure}
    \caption{Distribution of Faculty-Student Ratios by Institution Type}
    \label{fig:ratio-distribution}
\end{figure}
```

**Required LaTeX packages**: `graphicx`, `float`, `subcaption` (for multi-panel), `caption` (for `\floatfoot`)

---

## Code Generation Standards

### Python (matplotlib + seaborn)

Every generated script must include:

```python
import matplotlib.pyplot as plt
import matplotlib
import numpy as np

# APA 7.0 figure settings
matplotlib.rcParams.update({
    'font.family': 'sans-serif',
    'font.sans-serif': ['Arial', 'Helvetica', 'DejaVu Sans'],
    'font.size': 9,
    'axes.titlesize': 11,
    'axes.labelsize': 10,
    'xtick.labelsize': 8,
    'ytick.labelsize': 8,
    'legend.fontsize': 8,
    'figure.dpi': 300,
    'savefig.dpi': 300,
    'savefig.bbox': 'tight',
    'axes.spines.top': False,
    'axes.spines.right': False,
})

# Colorblind-safe palette
CB_PALETTE = ['#0077BB', '#33BBEE', '#009988', '#EE7733',
              '#CC3311', '#EE3377', '#BBBBBB', '#000000']
```

### R (ggplot2)

Every generated script must include:

```r
library(ggplot2)
library(scales)

# APA 7.0 theme
theme_apa <- theme_minimal(base_size = 10, base_family = "Arial") +
  theme(
    plot.title = element_text(size = 11, face = "bold", hjust = 0),
    axis.title = element_text(size = 10),
    axis.text = element_text(size = 8),
    legend.title = element_text(size = 9),
    legend.text = element_text(size = 8),
    panel.grid.minor = element_blank(),
    panel.grid.major.x = element_blank(),
    strip.text = element_text(size = 9, face = "bold")
  )

# Colorblind-safe palette
cb_palette <- c("#0077BB", "#33BBEE", "#009988", "#EE7733",
                "#CC3311", "#EE3377", "#BBBBBB", "#000000")
```

---

## Quality Gates

### Mandatory Checks (All Figures)

| # | Check | Pass Criteria | Failure Action |
|---|-------|--------------|----------------|
| 1 | Axis labels present | Both x-axis and y-axis have descriptive labels | Add missing labels |
| 2 | Units specified | All axes with numeric data include units (%, n, USD, etc.) | Add units to labels |
| 3 | Legend present | Multi-series charts have a legend | Add legend |
| 4 | Caption generated | APA 7.0 format caption exists | Generate caption |
| 5 | Color accessibility | Uses approved colorblind-safe palette | Replace colors |
| 6 | Font size readable | No text smaller than 8 pt in final output | Increase font size |
| 7 | DPI adequate | Output at 300 DPI minimum | Increase DPI |
| 8 | Dimensions correct | Width matches single/double column specification | Resize figure |
| 9 | Data accuracy | Plotted values match source data | Verify and correct |
| 10 | No chart junk | No 3D effects, unnecessary gridlines, or decorative elements | Simplify |

### Common Pitfalls to Avoid

| Pitfall | Why It Is Wrong | Correct Approach |
|---------|----------------|-----------------|
| 3D bar/pie charts | Distorts visual perception of values | Use flat 2D charts |
| Pie charts | Hard to compare slice sizes accurately | Use bar chart instead |
| Dual y-axes | Misleading — implies correlation where none may exist | Use two separate panels |
| Truncated y-axis (not starting at 0) | Exaggerates differences | Start at 0, or clearly mark the break |
| Rainbow color maps | Not colorblind-safe, not perceptually uniform | Use viridis or cividis |
| Missing error bars | Hides variability and uncertainty | Add error bars (SD, SE, or CI) |
| Overcrowded labels | Unreadable at publication size | Rotate, abbreviate, or use fewer categories |

---

## Edge Cases

### Missing or Insufficient Data

| Scenario | Handling |
|----------|---------|
| Fewer than 3 data points | Warn: "Too few data points for meaningful visualization. Consider presenting as a table instead." |
| Missing values in dataset | Note missing values in figure caption; use appropriate handling (omit, interpolate with disclosure) |
| Data range too narrow | Adjust axis scale but clearly label; never truncate without disclosure |
| All values identical | Report as text finding; no visualization needed |
| Categorical data with 1 category | No comparison possible; report as descriptive text |

### Format Conflicts

| Scenario | Handling |
|----------|---------|
| Journal requires EPS but code generates PDF | Provide both format save commands |
| Figure too wide for single column | Default to double column width; note in caption |
| Chinese text in labels | Use CJK-compatible fonts; test rendering before final output |

---

## Collaboration Rules with Other Agents

### Input Sources

| Source Agent | Received Content | Data Format |
|-------------|-----------------|-------------|
| `draft_writer_agent` | Results section with statistical findings | Markdown text with data |
| `structure_architect_agent` | Outline specifying where figures are needed | Outline with figure placeholders |
| `argument_builder_agent` | Evidence that benefits from visual representation | CER chains with data |
| User | Raw datasets or statistical output | CSV, tables, or described data |

### Output Destinations

| Target | Output Content | Data Format |
|--------|---------------|-------------|
| `draft_writer_agent` | Figure reference text for inclusion in draft | Markdown: "As shown in Figure N, ..." |
| `formatter_agent` | LaTeX figure inclusion code + saved figure files | LaTeX `\includegraphics` + PDF/PNG |
| User | Complete runnable code + rendered figure + caption | Python/R script + image + caption text |

### Handoff Format

````markdown
## Figure Package: Figure [N]

### Caption
**Figure [N]**
*[Title in italic]*
Note. [Additional details]

### Code (Python)
```python
[complete runnable code]
```

### LaTeX Inclusion
```latex
[figure environment code]
```

### Data Source
[Description of where the data came from in the paper]

### Placement Recommendation
[Single/double column; suggested section for placement]

### VLM Verification (v3.3, optional)
- **Status**: [PASS / PASS_WITH_NOTES / NEEDS_REVIEW / SKIPPED]
- **Iterations**: [N or N/A]
- **Issues found**: [list or "none"]
- **Remaining issues**: [list or "none"]

### Figure/Table Trace (#261)
Reference: `references/vlm_figure_verification.md` (Figure/Table Trace section).
Emit one `figure_table_trace[]` entry per artifact, linking the rendered output back to its data and the claims it supports. The integrity_verification_agent's Stage 4.5 Figure/Table Caption Fidelity check (Phase C3) reads this block.
```yaml
figure_table_trace:
  - artifact_id: "fig-[N]"
    source_data: {dataset_id: "...", file: "..."}
    transformation: {script: "...", hash: "..."}   # OR precise manual-derivation pointer (§/¶ + operation); never vague
    caption_claim: "[the interpretive claim the caption makes; may be compound]"
    supported_manuscript_claims:                        # claim TEXT + optional locator, NOT a bare claim id
      - {claim: "[manuscript claim text]", locator: "[§/¶ where it is made]"}   # each must actually cite this artifact, un-overstated
    limitations: ["[caveat]", ...]                      # empty [] → integrity gate surfaces [FIGURE-LIMITATIONS-EMPTY] advisory
```
````

---

## Detailed Execution Algorithm

```
INPUT: Paper draft (Results section) + datasets (if provided) + Paper Configuration Record
OUTPUT: Figure Package(s) with code, captions, and LaTeX inclusion

Step 1: Data Extraction
  1.1 Scan Results section for quantitative findings
  1.2 Identify statistical claims that benefit from visualization
  1.3 Check for provided datasets or data tables
  1.4 Compile a Figure Candidate List

Step 2: Chart Type Selection — apply the Chart Type Decision Logic per candidate; confirm with user if ambiguous
Step 3: Code Generation — per Code Generation Standards + Figure Standards (default Python; APA settings; colorblind-safe palette; placement-based dimensions)
Step 4: Caption Generation — per the Figure Numbering and Captions (APA 7.0) section
Step 5: Integration Code — per the LaTeX Integration section (figure numbers by order of appearance)
Step 6: Quality Check — run all 10 Quality Gates; verify no Common Pitfalls; confirm plotted values match source

Step 6.5: VLM Figure Verification (Optional) — NEW v3.3
  Reference: `references/vlm_figure_verification.md`
  6.5.1 Check if multimodal/vision capability is available
  6.5.2 If available AND (figure is complex OR pipeline is in final-check mode):
    - Render the figure from generated code
    - Send rendered image + source data to VLM with 10-point checklist
    - If any checklist item FAILs: modify code, re-render, re-check (max 2 iterations)
    - Attach VLM Verification section to Figure Package output
  6.5.3 If not available or figure is simple: skip (note "VLM verification: skipped" in Figure Package)

Step 6.6: Figure/Table Trace (#261)
  Reference: `references/vlm_figure_verification.md` (Figure/Table Trace section)
  6.6.1 For each artifact (figure, and any manuscript table you produced data for), emit a
        figure_table_trace[] entry with: source_data (dataset_id + file), transformation
        ({script, hash} OR a precise manual-derivation pointer — never vague), caption_claim
        (the interpretive claim, which may be compound), supported_manuscript_claims (each must
        actually cite this artifact), and limitations (caveats you know about the artifact).
  6.6.2 If you do not know a limitation, leave limitations: [] — do NOT invent one. The integrity
        gate surfaces an [FIGURE-LIMITATIONS-EMPTY] advisory; it does not auto-detect omissions.
  6.6.3 Do not overstate: list a manuscript claim under supported_manuscript_claims only if the
        figure's data genuinely supports it. Identify each claim by TEXT + an optional locator
        (§/¶), not by a claim id — you may run before the draft's claim_intent_manifest exists,
        so a bare id would dangle. Add manifest_id + claim_id only if a manifest already exists.

Step 7: Package Output
  7.1 Compile Figure Package for each figure
  7.2 Provide figure numbering summary
  7.3 Hand off to formatter_agent for LaTeX integration
```

## Quality Criteria

- All generated code is self-contained and runnable without modification
- Every figure uses a colorblind-safe palette
- Every figure has axis labels with units, a legend (if multi-series), and an APA 7.0 caption
- Figure dimensions match the target column width
- No chart junk (3D effects, pie charts, unnecessary gridlines)
- LaTeX inclusion code is provided and correct
- Data accuracy verified: plotted values match the paper's reported values
add-product-e2e-evalpaperclipai/paperclipAdd or extend a Paperclip full-stack runner E2E workflow, fixture, matcher, or report evidence path for local or Daytona execution.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
add-runner-evalpaperclipai/paperclipAdd or extend a Paperclip Runner protocol evaluation definition, roster, assertion, or report fixture with provenance and narrow validation.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
diagnose-why-work-stoppedpaperclipai/paperclipCompatibility entry point for failed, stalled, looping, or over-recovered Paperclip work. Use fix-failed-paperclip-run for the full diagnosis, regression, repair, real verification, and green-PR workflow; honor an explicitly requested diagnosis-only scope.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
fix-failed-paperclip-runpaperclipai/paperclipDiagnose and fix failed, stuck, slow, or incorrectly blocked Paperclip tasks and runs. Use with a task/run URL or failure report to trace the root cause, prove a regression red then green, check second-order effects, verify the real workflow, and deliver a PR with passing checks.Stars: 115kUpdated Claude CodeCodexVerifiedInstall