Paper figures
Figures are drawn by the project's figures.py from data files, at the exact width they print at,
and saved with a record of where their numbers came from.
from advays_papers.figures import charts, save
fig, ax = charts.ranked_bars(
["Method (ours)", "Baseline", "Random"], [0.42, 0.31, 0.10],
errs=[0.03, 0.02, 0.004], roles=["primary", "baseline", "reference"],
xlabel="Macro-AUPRC", floor=0.10, floor_label="floor",
slot="column", venue="ieee_journal")
save(fig, "figures", "baselines",
caption="Macro-AUPRC for the method and each baseline.",
answers="Does the method beat the baselines by more than the run-to-run spread?",
sources=["data/results.json"], command="python figures.py")
Run with python -m advays_papers figures <folder>.
Start from the reviewer's question
Every figure answers one question. Decide the question, then pick the builder.
| Question | Builder |
|---|---|
| Does the method beat the baselines, and by how much? | charts.ranked_bars |
| What does each ablation or condition score? | charts.bars |
| Is the result stable across folds or datasets? | charts.grouped_bars |
| Is the spread from the seed or from the data split? | charts.run_strip |
| Did training converge? Is it overfitting? | charts.learning_curves |
| Is this metric honest for this class balance? | charts.metric_vs_floor |
| Had the simulation or signal settled before analysis? | charts.timeseries |
| What goes where in the model or pipeline? | charts.flow_diagram |
For anything else, call style.figure(slot, venue=...) and draw on the axes yourself; the style,
sizing and save still apply. charts.panels(n, slot="wide") gives side-by-side axes and
panel_title(ax, "a", "Title") labels them (a) Title so the caption can refer to panels.
If a figure does not answer a question the text asks, cut the figure.
The rules
- Draw at final size.
slot="column"is one text column,slot="wide"spans the page. The width comes from the venue (IEEE: 3.50 in and 7.16 in). Never draw wide and shrink into a column: a 7 in figure placed in a 3.5 in column prints every label at half size.checkflags a figure whose drawn width does not match its slot. - Nothing under 7 pt.
saveraises if any text on the figure is smaller. Shorten the label or split the figure; do not lower the limit. - Colour carries a role.
primary(the method),baseline,reference(chance, floor, naive scorers),accent(ablations, mean lines),positive,negative,muted. The palette is Okabe-Ito, which survives colour-blind readers and greyscale printing. Do not add colours for decoration, and do not rely on colour alone when two series could be confused: use the legend order, markers or direct labels too. - Show the uncertainty. Error bars on every aggregated value, and the caption says what
they are (one SD over 3 seeds, a 95% bootstrap interval, a range). For five or fewer runs per
group, show the runs themselves with
run_stripinstead of a bar. - Draw the reference level. Chance, the prevalence floor, the previous best. A bar means little without the line it should be compared against.
- Bars start at zero. No truncated axes on bar charts. Lines may use a tight range.
- No title inside a single-panel figure. The caption is the title. Panel titles are for multi-panel figures only.
- Print the value on bars when a reader will want the number (the builders do this).
- Record the source. Pass
sources=[...]tosave. The manifest stores a sha256 of each data file with a path relative to the figure folder, so it survives a move to another machine. - Never plot numbers typed into the script. Read them from the results file the experiment wrote. A typed array is a figure that silently goes stale.
Captions
A caption lets a reader understand the figure without the text: what is plotted, what the error
bars are, what n is, and the one thing to notice. End it with a full stop. In paper.md:
{#fig:baselines}
Add wide inside the braces for a figure that spans both columns, and draw it with slot="wide".
Structure and photo figures
Molecular renders, microscope images and photos are images you place, not charts you draw. Export them at 300 DPI at the slot width, add labels as real text (not baked-in screenshots), and give the viewing direction and scale in the caption. State what the image is evidence of and what it is not.
Then look at it
Open the PNG. Check: labels do not collide, the legend does not cover data, the smallest text is readable at 100% zoom, and the figure still makes sense in greyscale. Then build the paper and look at the page it lands on.
