Skip to content

Commit cf5ff1a

Browse files
JihaoXinclaude
andcommitted
Fix figure font size: generate figure_config.json before coder, use columnwidth
Problem: Coder agent created its own figure_config.json with figsize=7.0in, but most figures display at columnwidth (3.333in) in LaTeX. Fonts shrink ~50%. Fix: - Generate figure_config.json from venue geometry BEFORE coder runs - Coder prompt now shows exact config structure with columnwidth_in/textwidth_in - Explicit instruction: single-column figs use COL_W, full-width use TEXT_W - rcParams from config match LaTeX template font sizes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fce55e0 commit cf5ff1a

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

ark/pipeline.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,9 @@ def _run_dev_phase(self):
11321132
# ── FIGURES FIRST, THEN WRITE ──
11331133
# All figures must be ready before writer starts, so writer can reference them.
11341134

1135+
# Step 0: Generate figure_config.json with correct venue geometry BEFORE coder runs
1136+
self._generate_figure_config()
1137+
11351138
# Step A: Create plotting script from experiment results
11361139
self._create_plotting_script_if_needed()
11371140

@@ -1522,16 +1525,46 @@ def _create_plotting_script_if_needed(self):
15221525
## Experiment findings summary:
15231526
{findings[:3000]}
15241527
1528+
## CRITICAL: Figure Config (read this FIRST)
1529+
{figures_dir}/figure_config.json contains the EXACT dimensions from the LaTeX template.
1530+
You MUST load it and use its values. The config has this structure:
1531+
```json
1532+
{{
1533+
"geometry": {{
1534+
"columnwidth_in": 3.333, // width for single-column figures
1535+
"textwidth_in": 7.0, // width for full-width figures
1536+
"font_size_pt": 10 // base font size matching LaTeX body text
1537+
}},
1538+
"matplotlib_rcparams": {{ ... }}, // apply ALL of these via plt.rcParams.update()
1539+
"sizes": {{
1540+
"single_column": [3.333, 2.333], // figsize for single-column figures
1541+
"double_column": [7.0, 2.45] // figsize for full-width figures
1542+
}}
1543+
}}
1544+
```
1545+
1546+
Load it like this:
1547+
```python
1548+
with open('{figures_dir}/figure_config.json') as f:
1549+
cfg = json.load(f)
1550+
plt.rcParams.update(cfg['matplotlib_rcparams'])
1551+
COL_W = cfg['geometry']['columnwidth_in'] # for single-column figures
1552+
TEXT_W = cfg['geometry']['textwidth_in'] # for full-width figures
1553+
```
1554+
1555+
Most statistical figures should use single_column size: figsize=(COL_W, COL_W*0.7).
1556+
Only use double_column for multi-panel figures (side-by-side subplots).
1557+
15251558
## Requirements:
1526-
1. Read {figures_dir}/figure_config.json for dimensions and matplotlib rcParams
1559+
1. Load figure_config.json as shown above — do NOT hardcode dimensions
15271560
2. Generate at least 2 statistical figures:
15281561
a) Main results comparison (bar chart or horizontal bar chart)
15291562
b) Ablation or analysis chart (grouped bars, line chart, or heatmap)
15301563
3. Save each figure as BOTH PDF and PNG to {figures_dir}/
15311564
4. Name figures descriptively: fig_main_results.pdf, fig_ablation.pdf, etc.
15321565
15331566
## Style Guide (MUST follow):
1534-
- Load rcParams from figure_config.json
1567+
- Apply ALL rcParams from figure_config.json (font sizes match LaTeX template)
15351568
- Wong colorblind-safe palette: ['#0072B2', '#D55E00', '#009E73', '#CC79A7', '#E69F00', '#56B4E9']
15361569
- Add hatching patterns for bar charts (colorblind accessibility)
15371570
- Use horizontal bars when there are 5+ categories (avoids x-label overlap)

0 commit comments

Comments
 (0)