Skip to content

Look at the Rendered Figure, Not Just the Exit Code

2026-07-20

Claude Code edits the script that draws your results figure. It exits 0. The figure can still be wrong: error bars missing, a legend covering the curve you're discussing, a y-axis that starts at 0.6 and turns a 2-point gap into a cliff. An exit code checks that the script ran. It does not check what a reader sees.

Anthropic's best practices for Claude Code include this pattern for visual work: take a screenshot of the result, compare it to the original, list the differences and fix them. For a paper figure or an eval dashboard, the "original" is a checklist you write once:

  • axis labels with units;
  • n stated for each point or bar;
  • error bars present, and the caption says what they are (standard error, a 95% interval, or something else);
  • an axis range you chose on purpose, not one the library chose for you;
  • nothing covering the data.

The check. Ask Claude to render the figure to a PNG, read the image, and report against each checklist item with a yes or no. Then do the part a picture can't: pick three plotted points and compare them by hand with the results table. A figure can look right and plot the wrong column, or the mean of the wrong seeds.

The model's reading of an image can be mistaken, so treat its report as a lead, the way you would a first reviewer's. Keep the before and after PNGs with the commit so a coauthor can see what changed without rerunning anything.

For an interactive dashboard, add what a static image misses: the loading state, an empty result, and whether a filter actually changes the numbers.

What an error bar should represent, and how to compute one from n, is the subject of Chapter 16 of the book.