Skip to content

What Can AI Find Behind a Chart?

An AI agent can trace a chart to the code that draws it, but explaining an earlier choice may require the request that led to the change.

At an October teaching demo, data scientist Eric Ma asked his audience which parts of a chart they wanted to investigate. He drew boxes around the regions they picked. Then he asked an AI agent to find strong results, giving those areas particular attention. The agent came back with a new chart that included strong results both inside and outside the boxes. Ma had used the boxes to show where to focus, not to draw a boundary around what the agent could consider.

The boxes gave the agent something precise without making Ma spell out every coordinate. But suppose someone else opened the notebook a month later and asked why the follow-up chart included a point outside a box. They might be able to find the code that chose it. They’d need a record of Ma’s request to know he had asked for emphasis rather than exclusion.

A December 3 preprint tests these as separate jobs. An agent that can read an image may only need a marked screenshot to find the code behind a chart. When you want it to explain why the chart was made that way, the useful record goes further: it connects what someone asked for to the part of the work they changed.

Finding what drew it

The study used data notebooks, documents that run small blocks of code called cells and display their results. The cell that draws a chart might get its numbers from a second cell that filters the data, which in turn might depend on a third that loads it. In an analysis of public notebook histories, the researchers found that 86% of charts in their sample depended on other cells. A chart can be easy to point at and still take several steps to trace.

In replays of 22 real requests, 4 agents worked with the notebook files, change histories and discussion threads. When the written question was their only pointer to the output, they found the cell that drew or laid it out in 39% of runs. With the researchers’ tool, marimo-lens, which links a selected output to the cell that produced it and the cells it depends on, they did so in 99%. A simpler option also worked for the 2 agents that could read images. A circled screenshot got them to the right cell in every run and used fewer input tokens. This tested whether agents found the code, not whether they checked the calculation.

Finding why someone changed it

The harder test gave agents 13 outputs with an earlier request. With a marked screenshot and the notebook’s change history but no discussion threads, agents that could read images could sometimes describe what the earlier edit had done. They didn’t recover the original request in any of 78 runs. With marimo-lens and a record linking requests to the cells they changed, the 4 agents recovered the words and who said them in 95% of runs. The researchers reconstructed those links from 3 notebooks made by 2 teams. The result shows what agents could recover from a prepared record, not what people would actually save while working.

Even a genuine request can be the wrong one. In one test, the same block of code drew both a scatter plot and a heat map. An agent asked about the scatter plot sometimes brought back a real request about the heat map. The tool knew where the user had pointed, but the older requests were tied to the shared code. If you’re reviewing an explanation, ask which part of a chart an old note applies to, not just whether the note exists. And if you try the tool yourself, the standard setup doesn’t keep resolved requests. That history has to be turned on.

What to check after a change

In a student notebook on carbon emissions, a contributor named Karim removed the right margin of a chart because he thought it looked better. Mayssae Essabbar answered that she had added the space so the whole value would appear in blue when someone selected a bar at the far right. The code could tell a future editor the size of the margin. The comment told them what the margin was for.

If you ask an agent to tidy a chart like that, you don’t have to insist it keep the old margin. You can give it the reason and let it find a different way to make room. When it comes back with a neater chart, select the rightmost bar. Can you still read the whole value?

Sources