psyclaw 0.28.0 → 0.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/agents/recommended/catalog.json +99 -0
- package/dist/apps/panel/index.html +5 -5
- package/dist/src/adapters/pi/extension.js +164 -18
- package/dist/src/adapters/pi/extension.js.map +1 -1
- package/dist/src/adapters/pi/rpc.d.ts +2 -0
- package/dist/src/adapters/pi/rpc.js +9 -2
- package/dist/src/adapters/pi/rpc.js.map +1 -1
- package/dist/src/agents/recommended-personas.d.ts +42 -0
- package/dist/src/agents/recommended-personas.js +135 -0
- package/dist/src/agents/recommended-personas.js.map +1 -0
- package/dist/src/ars/mode-editor.d.ts +20 -0
- package/dist/src/ars/mode-editor.js +57 -0
- package/dist/src/ars/mode-editor.js.map +1 -0
- package/dist/src/ars/profile.d.ts +4 -1
- package/dist/src/ars/profile.js +23 -6
- package/dist/src/ars/profile.js.map +1 -1
- package/dist/src/cli.js +6 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/src/creation/contracts.d.ts +3 -0
- package/dist/src/creation/service.js +17 -5
- package/dist/src/creation/service.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/orchestration/bundled-personas.d.ts +16 -0
- package/dist/src/orchestration/bundled-personas.js +101 -0
- package/dist/src/orchestration/bundled-personas.js.map +1 -0
- package/dist/src/orchestration/effects.d.ts +8 -0
- package/dist/src/orchestration/effects.js +39 -0
- package/dist/src/orchestration/effects.js.map +1 -0
- package/dist/src/orchestration/personas.d.ts +2 -1
- package/dist/src/orchestration/personas.js +20 -7
- package/dist/src/orchestration/personas.js.map +1 -1
- package/dist/src/orchestration/pi-executor.d.ts +9 -5
- package/dist/src/orchestration/pi-executor.js +55 -22
- package/dist/src/orchestration/pi-executor.js.map +1 -1
- package/dist/src/orchestration/research-agents.d.ts +3 -7
- package/dist/src/orchestration/research-agents.js +5 -69
- package/dist/src/orchestration/research-agents.js.map +1 -1
- package/dist/src/panel/server.js +6 -0
- package/dist/src/panel/server.js.map +1 -1
- package/dist/src/style/cli-ui.d.ts +14 -0
- package/dist/src/style/cli-ui.js +45 -0
- package/dist/src/style/cli-ui.js.map +1 -1
- package/dist/src/tui/skill-manager.js +1 -1
- package/dist/src/tui/skill-manager.js.map +1 -1
- package/dist/src/updates/update.js +9 -3
- package/dist/src/updates/update.js.map +1 -1
- package/package.json +11 -3
- package/vendor/academic-paper-skills/LICENSE +21 -0
- package/vendor/academic-paper-skills/NOTICE.md +7 -0
- package/vendor/academic-paper-skills/PSYCLAW_SOURCE.json +14 -0
- package/vendor/academic-paper-skills/academic-paper-composer/SKILL.md +840 -0
- package/vendor/academic-paper-skills/academic-paper-composer/references/section_guides.md +675 -0
- package/vendor/academic-paper-skills/academic-paper-composer/references/writing_standards.md +629 -0
- package/vendor/academic-paper-skills/academic-paper-composer/scripts/chapter_quality_check.py +470 -0
- package/vendor/academic-paper-skills/academic-paper-composer/scripts/final_evaluation.py +550 -0
- package/vendor/academic-paper-skills/academic-paper-strategist/SKILL.md +670 -0
- package/vendor/academic-paper-skills/academic-paper-strategist/references/quality_standards.md +336 -0
- package/vendor/academic-paper-skills/academic-paper-strategist/references/search_strategy.md +459 -0
- package/vendor/academic-paper-skills/academic-paper-strategist/scripts/evaluate_samples.py +300 -0
- package/vendor/academic-paper-skills/academic-paper-strategist/scripts/gap_analysis.py +399 -0
- package/vendor/ars/pi/wrapper.js +9 -0
- package/vendor/nature-skills/LICENSE +201 -0
- package/vendor/nature-skills/NOTICE.md +7 -0
- package/vendor/nature-skills/PSYCLAW_SOURCE.json +19 -0
- package/vendor/nature-skills/skills/nature-figure/README.md +107 -0
- package/vendor/nature-skills/skills/nature-figure/README_EN.md +107 -0
- package/vendor/nature-skills/skills/nature-figure/SKILL.md +154 -0
- package/vendor/nature-skills/skills/nature-figure/agents/openai.yaml +4 -0
- package/vendor/nature-skills/skills/nature-figure/evals/evals.json +325 -0
- package/vendor/nature-skills/skills/nature-figure/manifest.yaml +103 -0
- package/vendor/nature-skills/skills/nature-figure/references/ai-graphical-abstract-workflow.md +129 -0
- package/vendor/nature-skills/skills/nature-figure/references/api.md +576 -0
- package/vendor/nature-skills/skills/nature-figure/references/asset-adaptation.md +72 -0
- package/vendor/nature-skills/skills/nature-figure/references/backend-selection.md +118 -0
- package/vendor/nature-skills/skills/nature-figure/references/chart-types.md +348 -0
- package/vendor/nature-skills/skills/nature-figure/references/common-patterns.md +371 -0
- package/vendor/nature-skills/skills/nature-figure/references/demos.md +58 -0
- package/vendor/nature-skills/skills/nature-figure/references/design-theory.md +467 -0
- package/vendor/nature-skills/skills/nature-figure/references/figure-contract.md +122 -0
- package/vendor/nature-skills/skills/nature-figure/references/figure-legend-conventions.md +90 -0
- package/vendor/nature-skills/skills/nature-figure/references/multipanel-evidence-architecture.md +268 -0
- package/vendor/nature-skills/skills/nature-figure/references/nature-2026-observations.md +124 -0
- package/vendor/nature-skills/skills/nature-figure/references/nature-article-requirements.md +149 -0
- package/vendor/nature-skills/skills/nature-figure/references/openrouter-image-generation.md +141 -0
- package/vendor/nature-skills/skills/nature-figure/references/qa-contract.md +344 -0
- package/vendor/nature-skills/skills/nature-figure/references/r-template-index.md +66 -0
- package/vendor/nature-skills/skills/nature-figure/references/r-workflow.md +234 -0
- package/vendor/nature-skills/skills/nature-figure/references/template-catalog.md +33 -0
- package/vendor/nature-skills/skills/nature-figure/references/tutorials.md +260 -0
- package/vendor/nature-skills/skills/nature-figure/requirements.txt +1 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/audit_figure_collisions.py +742 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/audit_panel_alignment.py +933 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/audit_pdf_text.py +152 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/figure_safety.py +50 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/generate_openrouter_schematic.py +260 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/nature_figure_backend.py +93 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/panel_alignment.R +188 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/plot_templates.py +604 -0
- package/vendor/nature-skills/skills/nature-figure/scripts/validate_figure.py +835 -0
- package/vendor/nature-skills/skills/nature-figure/static/core/contract.md +55 -0
- package/vendor/nature-skills/skills/nature-figure/static/core/stance.md +41 -0
- package/vendor/nature-skills/skills/nature-figure/static/fragments/backend/python.md +56 -0
- package/vendor/nature-skills/skills/nature-figure/static/fragments/backend/r.md +63 -0
- package/vendor/nature-skills/skills/nature-figure/tests/test_figure_safety.py +209 -0
- package/vendor/nature-skills/skills/nature-polishing/README.md +58 -0
- package/vendor/nature-skills/skills/nature-polishing/README_EN.md +58 -0
- package/vendor/nature-skills/skills/nature-polishing/SKILL.md +111 -0
- package/vendor/nature-skills/skills/nature-polishing/agents/openai.yaml +4 -0
- package/vendor/nature-skills/skills/nature-polishing/manifest.yaml +101 -0
- package/vendor/nature-skills/skills/nature-polishing/references/latex-layout.md +211 -0
- package/vendor/nature-skills/skills/nature-polishing/references/nat-comms-2025-diction.md +73 -0
- package/vendor/nature-skills/skills/nature-polishing/references/phrasebank-playbook.md +175 -0
- package/vendor/nature-skills/skills/nature-polishing/references/published-article-patterns.md +126 -0
- package/vendor/nature-skills/skills/nature-polishing/references/section-moves.md +252 -0
- package/vendor/nature-skills/skills/nature-polishing/references/style-guardrails.md +94 -0
- package/vendor/nature-skills/skills/nature-polishing/references/writing-strategy.md +160 -0
- package/vendor/nature-skills/skills/nature-polishing/static/core/failure-modes.md +29 -0
- package/vendor/nature-skills/skills/nature-polishing/static/core/output-format.md +21 -0
- package/vendor/nature-skills/skills/nature-polishing/static/core/stance.md +26 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/journal/generic.md +17 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/journal/nat-comms.md +38 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/journal/nat-mach-intell.md +102 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/journal/nature.md +19 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/language/en.md +19 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/language/zh-to-en.md +19 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/algorithmic.md +18 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/hypothesis.md +17 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/methods.md +35 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/research.md +29 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/paper_type/review.md +17 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/abstract.md +26 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/conclusion.md +15 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/discussion.md +48 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/intro.md +33 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/methods.md +26 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/results.md +61 -0
- package/vendor/nature-skills/skills/nature-polishing/static/fragments/section/title.md +17 -0
- package/vendor/nature-skills/skills/nature-ref-verifier/README.md +44 -0
- package/vendor/nature-skills/skills/nature-ref-verifier/README_EN.md +44 -0
- package/vendor/nature-skills/skills/nature-ref-verifier/SKILL.md +196 -0
- package/vendor/nature-skills/skills/nature-ref-verifier/agents/openai.yaml +4 -0
- package/vendor/nature-skills/skills/nature-ref-verifier/manifest.yaml +19 -0
- package/vendor/nature-skills/skills/nature-ref-verifier/references/common-patterns.md +96 -0
- package/vendor/nature-skills/skills/nature-shared/README.md +43 -0
- package/vendor/nature-skills/skills/nature-shared/README_EN.md +43 -0
- package/vendor/nature-skills/skills/nature-shared/SKILL.md +33 -0
- package/vendor/nature-skills/skills/nature-shared/agents/openai.yaml +6 -0
- package/vendor/nature-skills/skills/nature-shared/core/consistency-sweep.md +122 -0
- package/vendor/nature-skills/skills/nature-shared/core/discussion-argument-language.md +192 -0
- package/vendor/nature-skills/skills/nature-shared/core/ethics.md +88 -0
- package/vendor/nature-skills/skills/nature-shared/core/main-text-discipline.md +179 -0
- package/vendor/nature-skills/skills/nature-shared/core/nature-abstract.md +171 -0
- package/vendor/nature-skills/skills/nature-shared/core/nature-introduction.md +164 -0
- package/vendor/nature-skills/skills/nature-shared/core/nature-results-discussion.md +215 -0
- package/vendor/nature-skills/skills/nature-shared/core/paper-type-taxonomy.md +41 -0
- package/vendor/nature-skills/skills/nature-shared/core/reader-workflow.md +21 -0
- package/vendor/nature-skills/skills/nature-shared/core/research-compliance.md +192 -0
- package/vendor/nature-skills/skills/nature-shared/core/terminology-ledger.md +58 -0
- package/vendor/nature-skills/skills/nature-shared/journal-formats/nat-comms.md +139 -0
- package/vendor/nature-skills/skills/nature-shared/journal-formats/nature-machine-intelligence.md +431 -0
- package/vendor/nature-skills/skills/nature-shared/journal-formats/nature.md +313 -0
- package/vendor/nature-skills/skills/nature-shared/manifest.yaml +52 -0
- package/vendor/nature-skills/skills/nature-shared/scripts/check_consistency.py +273 -0
- package/vendor/nature-skills/skills/nature-shared/tests/test_check_consistency.py +63 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
# Common Patterns — Nature Figure Making
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- [Pattern 1: Ultra-wide multi-metric bar panel](#pattern-1-ultra-wide-multi-metric-bar-panel)
|
|
6
|
+
- [Pattern 2: Dedicated legend panel](#pattern-2-dedicated-legend-panel)
|
|
7
|
+
- [Pattern 3: Categorical bars without x-tick labels](#pattern-3-categorical-bars-without-x-tick-labels)
|
|
8
|
+
- [Pattern 4: Dynamic y-axis tightening](#pattern-4-dynamic-y-axis-tightening)
|
|
9
|
+
- [Pattern 5: Alpha-graduated ablation bars (same color, varying opacity)](#pattern-5-alpha-graduated-ablation-bars-same-color-varying-opacity)
|
|
10
|
+
- [Pattern 6: Hatch encoding for print-safe grayscale](#pattern-6-hatch-encoding-for-print-safe-grayscale)
|
|
11
|
+
- [Pattern 7: Semantic or family color mapping](#pattern-7-semantic-or-family-color-mapping)
|
|
12
|
+
- [Pattern 8: In-bar text with luminance-aware color](#pattern-8-in-bar-text-with-luminance-aware-color)
|
|
13
|
+
- [Pattern 9: Fill-between trend with hatch (print-safe)](#pattern-9-fill-between-trend-with-hatch-print-safe)
|
|
14
|
+
- [Pattern 10: Annotate events on trend lines](#pattern-10-annotate-events-on-trend-lines)
|
|
15
|
+
- [Pattern 11: Grouped bars across multiple datasets (grouped-within-grouped)](#pattern-11-grouped-bars-across-multiple-datasets-grouped-within-grouped)
|
|
16
|
+
- [Pattern 12: Schematic hero panel with supporting quant row](#pattern-12-schematic-hero-panel-with-supporting-quant-row)
|
|
17
|
+
- [Pattern 13: Dark image plate with repeated views](#pattern-13-dark-image-plate-with-repeated-views)
|
|
18
|
+
- [Pattern 14: Clinical triptych](#pattern-14-clinical-triptych)
|
|
19
|
+
- [Pattern 15: Asymmetric hero panel](#pattern-15-asymmetric-hero-panel)
|
|
20
|
+
- [Pattern 16: Direct labels inside filled regions](#pattern-16-direct-labels-inside-filled-regions)
|
|
21
|
+
- [Related files](#related-files)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Reusable layout and encoding patterns used across publication-grade scripts.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Pattern 1: Ultra-wide multi-metric bar panel
|
|
29
|
+
|
|
30
|
+
For 3–4 metrics compared across many methods, use a wide canvas so bars and labels don't crowd.
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
fig = plt.figure(figsize=(45, 12)) # or (28, 6) for fewer metrics
|
|
34
|
+
gs = gridspec.GridSpec(1, n_metrics)
|
|
35
|
+
|
|
36
|
+
for i, metric in enumerate(metrics):
|
|
37
|
+
ax = fig.add_subplot(gs[i])
|
|
38
|
+
ax.bar(x, values[metric], color=colors, ...)
|
|
39
|
+
ax.set_ylabel(metric, fontsize=54, labelpad=12)
|
|
40
|
+
ax.set_xticks([])
|
|
41
|
+
|
|
42
|
+
# Last panel: legend only
|
|
43
|
+
ax_leg = fig.add_subplot(gs[-1])
|
|
44
|
+
ax_leg.legend(handles, labels, fontsize=38, loc='center', frameon=False)
|
|
45
|
+
ax_leg.set_axis_off()
|
|
46
|
+
|
|
47
|
+
fig.tight_layout(pad=2)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Rule**: Width often 3–4× height. Allows left-to-right narrative scanning.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Pattern 2: Dedicated legend panel
|
|
55
|
+
|
|
56
|
+
When the legend is large, give it its own axis so data panels stay clean.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
fig, axes = plt.subplots(1, n_data + 1, figsize=(...))
|
|
60
|
+
|
|
61
|
+
for i, ax in enumerate(axes[:-1]):
|
|
62
|
+
bars = ax.bar(...)
|
|
63
|
+
if i == 0:
|
|
64
|
+
handles, labels = ax.get_legend_handles_labels()
|
|
65
|
+
|
|
66
|
+
# Legend-only panel
|
|
67
|
+
axes[-1].legend(handles, labels, fontsize=28, loc='center', frameon=False)
|
|
68
|
+
axes[-1].set_axis_off()
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Pattern 3: Categorical bars without x-tick labels
|
|
74
|
+
|
|
75
|
+
When methods are named in the legend, hide x-ticks entirely.
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
ax.set_xticks([]) # removes ticks and labels
|
|
79
|
+
# Alternatively:
|
|
80
|
+
ax.set_xticklabels([]) # keeps tick marks, removes labels
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Pattern 4: Dynamic y-axis tightening
|
|
86
|
+
|
|
87
|
+
Never use 0–100 when all values are in 80–95.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
margin = (values.max() - values.min()) * 0.1 # 10% padding
|
|
91
|
+
ax.set_ylim([values.min() - margin, values.max() + margin])
|
|
92
|
+
|
|
93
|
+
# Manual ticks at clean round numbers
|
|
94
|
+
ax.set_yticks([0.75, 0.80, 0.85, 0.90])
|
|
95
|
+
ax.tick_params(axis='y', labelsize=36, length=10, width=2)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Pattern 5: Alpha-graduated ablation bars (same color, varying opacity)
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
import numpy as np
|
|
104
|
+
|
|
105
|
+
blue_rgb = (0.215686, 0.458824, 0.729412) # #3775BA as float tuple
|
|
106
|
+
n_ablations = len(ablation_configs)
|
|
107
|
+
alphas = np.linspace(0.2, 1.0, n_ablations)
|
|
108
|
+
colors = [(blue_rgb[0], blue_rgb[1], blue_rgb[2], a) for a in alphas]
|
|
109
|
+
# Full method → alpha=1.0, most ablated → alpha=0.2
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Pattern 6: Hatch encoding for print-safe grayscale
|
|
115
|
+
|
|
116
|
+
Add hatching so bars remain distinct when printed in black-and-white.
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
hatches = ['/', '\\\\', '.', 'x', 'o', '+']
|
|
120
|
+
for bar_container, hatch in zip(grouped_bars, hatches):
|
|
121
|
+
for patch in bar_container:
|
|
122
|
+
patch.set_hatch(hatch)
|
|
123
|
+
patch.set_edgecolor('black')
|
|
124
|
+
patch.set_linewidth(1.5)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Pattern 7: Semantic or family color mapping
|
|
130
|
+
|
|
131
|
+
Always map colors consistently across all panels in a figure:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
method_colors = {
|
|
135
|
+
'ResNet1d18': '#484878', # baseline_dark
|
|
136
|
+
'ResNet1d34': '#7884B4', # baseline_mid
|
|
137
|
+
'ECGFounder': '#B4C0E4', # baseline_soft
|
|
138
|
+
'CSFM-Tiny': '#E4E4F0', # ours_tiny
|
|
139
|
+
'CSFM-Base': '#E4CCD8', # ours_base
|
|
140
|
+
'CSFM-Large': '#F0C0CC', # ours_large
|
|
141
|
+
}
|
|
142
|
+
colors = [method_colors[m] for m in methods]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Prefer coherent hue families over alternating saturated blue/green/red just because categories differ.
|
|
146
|
+
Green and red should usually be reserved for **directional annotations**, not primary series identity:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
ax.scatter(x_gain, y_gain, marker='^', color='#2E9E44', s=90, zorder=6) # improvement
|
|
150
|
+
ax.scatter(x_drop, y_drop, marker='v', color='#E53935', s=90, zorder=6) # degradation
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Pattern 8: In-bar text with luminance-aware color
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
def annotate_bars(ax, bars, colors, fmt='{:.2f}', fontsize=32, offset=-0.10):
|
|
159
|
+
for bar, color in zip(bars, colors):
|
|
160
|
+
c = color.lstrip('#')
|
|
161
|
+
r, g, b = int(c[0:2],16)/255, int(c[2:4],16)/255, int(c[4:6],16)/255
|
|
162
|
+
lum = 0.299*r + 0.587*g + 0.114*b
|
|
163
|
+
textcolor = 'white' if lum < 0.5 else 'black'
|
|
164
|
+
value = bar.get_height()
|
|
165
|
+
ax.text(bar.get_x() + bar.get_width()/2,
|
|
166
|
+
value + offset,
|
|
167
|
+
fmt.format(value),
|
|
168
|
+
ha='center', va='bottom',
|
|
169
|
+
fontsize=fontsize, color=textcolor)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Pattern 9: Fill-between trend with hatch (print-safe)
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
ax.fill_between(x, 0, cumsum_series,
|
|
178
|
+
color=fill_color,
|
|
179
|
+
hatch='\\\\\\', # triple backslash for dense hatch
|
|
180
|
+
edgecolor='black',
|
|
181
|
+
label=label_name)
|
|
182
|
+
# Visually erase the border artifacts:
|
|
183
|
+
ax.fill_between(x, 0, cumsum_series,
|
|
184
|
+
facecolor='none',
|
|
185
|
+
edgecolor='white',
|
|
186
|
+
linewidth=2)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Pattern 10: Annotate events on trend lines
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
def mark_events(ax, x_labels, y_cumsum, events_dict, dy_fraction=0.1):
|
|
195
|
+
"""Add labeled arrows at event dates on a trend line."""
|
|
196
|
+
x_index = {label: i for i, label in enumerate(x_labels)}
|
|
197
|
+
y_lo, y_hi = ax.get_ylim()
|
|
198
|
+
dy = dy_fraction * (y_hi - y_lo)
|
|
199
|
+
for date, label in events_dict.items():
|
|
200
|
+
if date not in x_index:
|
|
201
|
+
continue
|
|
202
|
+
i = x_index[date]
|
|
203
|
+
stars = label.count('*')
|
|
204
|
+
clean_label = label.replace('*', '')
|
|
205
|
+
y_data = y_cumsum[i]
|
|
206
|
+
ax.annotate(
|
|
207
|
+
clean_label,
|
|
208
|
+
xy=(i, y_data),
|
|
209
|
+
xytext=(i, y_data + (1 + 0.8 * stars) * dy),
|
|
210
|
+
ha='center', va='bottom', fontsize=11,
|
|
211
|
+
arrowprops=dict(arrowstyle='-|>', lw=1.3, color='black',
|
|
212
|
+
shrinkA=0, shrinkB=0, mutation_scale=15)
|
|
213
|
+
)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Pattern 11: Grouped bars across multiple datasets (grouped-within-grouped)
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
num_methods = len(methods)
|
|
222
|
+
xtick_positions = []
|
|
223
|
+
|
|
224
|
+
for dataset_idx, dataset_name in enumerate(datasets):
|
|
225
|
+
x_start = dataset_idx * (num_methods + 1) # gap of 1 between groups
|
|
226
|
+
ax.bar(
|
|
227
|
+
np.arange(num_methods) + x_start,
|
|
228
|
+
values[dataset_name],
|
|
229
|
+
color=method_colors,
|
|
230
|
+
label=methods if dataset_idx == 0 else ['_nolegend_'] * num_methods,
|
|
231
|
+
)
|
|
232
|
+
xtick_positions.append(np.mean(np.arange(num_methods)) + x_start)
|
|
233
|
+
|
|
234
|
+
ax.set_xticks(xtick_positions)
|
|
235
|
+
ax.set_xticklabels(datasets)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Pattern 12: Schematic hero panel with supporting quant row
|
|
241
|
+
|
|
242
|
+
Use when one mechanism or fabrication story needs to lead, with 2–4 smaller evidence plots below.
|
|
243
|
+
|
|
244
|
+
```python
|
|
245
|
+
fig = plt.figure(figsize=(7.2, 6.2))
|
|
246
|
+
gs = fig.add_gridspec(
|
|
247
|
+
2, 4,
|
|
248
|
+
height_ratios=[2.2, 1.0],
|
|
249
|
+
hspace=0.18, wspace=0.28,
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
ax_top = fig.add_subplot(gs[0, :]) # hero schematic
|
|
253
|
+
ax_b = fig.add_subplot(gs[1, 0])
|
|
254
|
+
ax_c = fig.add_subplot(gs[1, 1:3])
|
|
255
|
+
ax_d = fig.add_subplot(gs[1, 3])
|
|
256
|
+
|
|
257
|
+
# top panel should carry the main palette and the main visual narrative
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Rules:
|
|
261
|
+
|
|
262
|
+
- Allocate `45–60%` of total height to the hero schematic.
|
|
263
|
+
- Reuse softened versions of the same colors in the lower plots.
|
|
264
|
+
- Keep support plots quieter than the hero panel.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Pattern 13: Dark image plate with repeated views
|
|
269
|
+
|
|
270
|
+
Use for microscopy, volume rendering, or fluorescence-heavy panels.
|
|
271
|
+
|
|
272
|
+
```python
|
|
273
|
+
fig = plt.figure(figsize=(7.2, 6.5))
|
|
274
|
+
gs = fig.add_gridspec(3, 5, hspace=0.08, wspace=0.04)
|
|
275
|
+
|
|
276
|
+
for r in range(3):
|
|
277
|
+
for c in range(5):
|
|
278
|
+
ax = fig.add_subplot(gs[r, c])
|
|
279
|
+
ax.set_facecolor('black')
|
|
280
|
+
ax.set_xticks([])
|
|
281
|
+
ax.set_yticks([])
|
|
282
|
+
for spine in ax.spines.values():
|
|
283
|
+
spine.set_visible(False)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Rules:
|
|
287
|
+
|
|
288
|
+
- Use black only within the image plate cells.
|
|
289
|
+
- Put channel labels, scale bars and small crop guides directly on the plate.
|
|
290
|
+
- Keep crop geometry and scale-bar placement consistent across the grid.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Pattern 14: Clinical triptych
|
|
295
|
+
|
|
296
|
+
Use for outcome-over-time figures that combine trajectories, effect sizes, and summary proportions.
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
fig = plt.figure(figsize=(7.2, 6.8))
|
|
300
|
+
gs = fig.add_gridspec(
|
|
301
|
+
3, 3,
|
|
302
|
+
height_ratios=[1.0, 1.35, 0.8],
|
|
303
|
+
hspace=0.28, wspace=0.32,
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
axes_top = [fig.add_subplot(gs[0, i]) for i in range(3)]
|
|
307
|
+
axes_mid = [fig.add_subplot(gs[1, i]) for i in range(3)]
|
|
308
|
+
axes_bot = [fig.add_subplot(gs[2, i]) for i in range(3)]
|
|
309
|
+
|
|
310
|
+
# Put one shared legend strip above axes_top rather than repeating legends.
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Rules:
|
|
314
|
+
|
|
315
|
+
- Keep the three columns semantically parallel.
|
|
316
|
+
- Use a dashed vertical reference line in the forest-plot row.
|
|
317
|
+
- Group shading in the forest-plot row should be pale and subordinate.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Pattern 15: Asymmetric hero panel
|
|
322
|
+
|
|
323
|
+
Use when one panel is conceptually central and should dominate.
|
|
324
|
+
|
|
325
|
+
```python
|
|
326
|
+
fig = plt.figure(figsize=(7.2, 5.8))
|
|
327
|
+
gs = fig.add_gridspec(3, 4, hspace=0.25, wspace=0.28)
|
|
328
|
+
|
|
329
|
+
ax_a = fig.add_subplot(gs[0, :2])
|
|
330
|
+
ax_b = fig.add_subplot(gs[0, 2])
|
|
331
|
+
ax_c = fig.add_subplot(gs[1, :2])
|
|
332
|
+
ax_d = fig.add_subplot(gs[1, 2])
|
|
333
|
+
ax_e = fig.add_subplot(gs[:, 3]) # hero panel spans all rows
|
|
334
|
+
ax_f = fig.add_subplot(gs[2, :2])
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Rule: do not normalize every subplot to the same size if the science does not have equal importance.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Pattern 16: Direct labels inside filled regions
|
|
342
|
+
|
|
343
|
+
Use when the same categorical structure repeats and a legend would become too large.
|
|
344
|
+
|
|
345
|
+
```python
|
|
346
|
+
for x_text, y_text, text, color in label_specs:
|
|
347
|
+
ax.text(
|
|
348
|
+
x_text, y_text, text,
|
|
349
|
+
color=color,
|
|
350
|
+
ha='center', va='center',
|
|
351
|
+
fontsize=9, fontweight='bold',
|
|
352
|
+
)
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Rules:
|
|
356
|
+
|
|
357
|
+
- Keep labels inside stable, visually large regions.
|
|
358
|
+
- Use a small white or black stroke if the fill varies strongly underneath.
|
|
359
|
+
- Prefer direct labels over a mega-legend for repeated stacked-area or phase diagrams.
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Related files
|
|
364
|
+
|
|
365
|
+
- [SKILL.md](../SKILL.md) — When to use this skill
|
|
366
|
+
- [api.md](api.md) — Helper function signatures and PALETTE
|
|
367
|
+
- [design-theory.md](design-theory.md) — Rationale behind every pattern above
|
|
368
|
+
- [nature-2026-observations.md](nature-2026-observations.md) — Real Nature page archetypes behind these patterns
|
|
369
|
+
- [tutorials.md](tutorials.md) — End-to-end walkthroughs
|
|
370
|
+
- [chart-types.md](chart-types.md) — Radar, 3D, scatter patterns
|
|
371
|
+
- [demos.md](demos.md) — Third-party demo map, copyright-aware reference use, and original reimplementation guidance
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# figures4papers Reference Index
|
|
2
|
+
|
|
3
|
+
Use this file when a user asks for a `figures4papers` look, cites the older
|
|
4
|
+
`scientific-figure-making` skill, or needs a concrete Python/matplotlib reference.
|
|
5
|
+
|
|
6
|
+
The retained third-party files live under `../assets/figures4papers/`. Before
|
|
7
|
+
opening or adapting them, read
|
|
8
|
+
`../assets/figures4papers/THIRD_PARTY_NOTICES.md`. These materials are not
|
|
9
|
+
automatically covered by the root MIT License, and their inclusion does not grant
|
|
10
|
+
additional reuse rights.
|
|
11
|
+
|
|
12
|
+
## Use boundary
|
|
13
|
+
|
|
14
|
+
1. Study layout, palette, axes, legends, and export structure as reference patterns.
|
|
15
|
+
2. Reimplement with original code and the user's own data whenever the upstream
|
|
16
|
+
license or written permission does not clearly authorize copying or modification.
|
|
17
|
+
3. Never reuse manuscript-specific labels, metric values, statistical results, or
|
|
18
|
+
visual assets as placeholders for real evidence.
|
|
19
|
+
4. Record the external reference and implementation provenance in the internal QA
|
|
20
|
+
record when it materially influenced the result.
|
|
21
|
+
5. Preserve the editable SVG/PDF/TIFF and source-data rules from `api.md` and
|
|
22
|
+
`qa-contract.md`.
|
|
23
|
+
|
|
24
|
+
## Retained project map
|
|
25
|
+
|
|
26
|
+
| Project | Open when | Local references |
|
|
27
|
+
|---------|-----------|------------------|
|
|
28
|
+
| `figure_ImmunoStruct` | Method-comparison and ablation bars | `../assets/figures4papers/figure_ImmunoStruct/` |
|
|
29
|
+
| `figure_CellSpliceNet` | Compact benchmark and cross-species bars | `../assets/figures4papers/figure_CellSpliceNet/` |
|
|
30
|
+
| `figure_brainteaser` | Category, rewriting, and self-correction panels | `../assets/figures4papers/figure_brainteaser/` |
|
|
31
|
+
| `figure_VIGIL` | Radar, trend, ablation, and probability/manifold panels | `../assets/figures4papers/figure_VIGIL/` |
|
|
32
|
+
| `figure_ophthal_review` | Time trends and composition heatmaps | `../assets/figures4papers/figure_ophthal_review/` |
|
|
33
|
+
| `figure_RNAGenScape` | Heatmaps, optimization, manifold, and sweep plots | `../assets/figures4papers/figure_RNAGenScape/` |
|
|
34
|
+
| `figure_Dispersion` | Conceptual sphere and observation panels | `../assets/figures4papers/figure_Dispersion/` |
|
|
35
|
+
| `figure_Cflows` | Diffusion, trajectory, comparison, and ablation panels | `../assets/figures4papers/figure_Cflows/` |
|
|
36
|
+
| `figure_FPGM` | Frequency-prior or distribution-style motivation | `../assets/figures4papers/figure_FPGM/` |
|
|
37
|
+
|
|
38
|
+
## Prefer repository-owned implementation paths
|
|
39
|
+
|
|
40
|
+
When copying is not clearly authorized, route the pattern through the repository's
|
|
41
|
+
own material:
|
|
42
|
+
|
|
43
|
+
| Requested pattern | Open and use |
|
|
44
|
+
|-------------------|--------------|
|
|
45
|
+
| Grouped bars, ablation bars, shared legends | `tutorials.md`, `common-patterns.md` |
|
|
46
|
+
| Radar or polar comparison | `chart-types.md`, then implement with original code |
|
|
47
|
+
| Trends, sweeps, and reference baselines | `tutorials.md`, `chart-types.md` |
|
|
48
|
+
| Heatmap or annotated matrix | `tutorials.md`, `template-catalog.md` |
|
|
49
|
+
| Probability or manifold concept panel | `chart-types.md` |
|
|
50
|
+
| Submission typography, palette, and export | `api.md`, `design-theory.md` |
|
|
51
|
+
| CSV-driven reproducible plots | `template-catalog.md`, `scripts/plot_templates.py` |
|
|
52
|
+
|
|
53
|
+
## Upstream source
|
|
54
|
+
|
|
55
|
+
<https://github.com/ChenLiu-1996/figures4papers>
|
|
56
|
+
|
|
57
|
+
Check the current upstream license and obtain permission when required before
|
|
58
|
+
redistributing, modifying, or publishing derived materials.
|