AI Prompts for Charts: The Number Is Right, the Picture Is Not
Image generated with AI.
Your number is right. The picture is what lies: a broken baseline, a missing denominator, a twin axis. Here is the six-field prompt that catches it.
Most bad charts contain no bad number. A bar starts at 60, a percentage arrives without a denominator, a second axis appears uninvited - and a correct figure becomes a claim the data never made. AI prompts for charts fail exactly here.
The number survives the audit. The picture is a second translation of that number into ink, and the reader believes the picture before reading the title or the axis.
Why AI Prompts for Charts Fail at the Last Step
The chain is short and nobody inspects the middle of it. You describe the analysis, the model writes code, the code draws. When the prompt says nothing about the axis, the chart type or the order of the bars, there is no gap left behind - there is a default: automatic axis limits, an automatic palette, a default chart type the library picked because it had to pick something.
The Gap the Model Fills
The model does not choose badly. It chooses what it was not told. A chart generated without instructions is the version of the data the tool considers reasonable, which is not the version the reader needs. The difference between those two versions is the entire subject of this post.
The Three Things It Cannot Know
Three decisions cannot be inferred from the CSV. What question the chart is answering. Who will read it and what decision they will take with it. And what zero means in that metric - zero sales is not zero customers, and a satisfaction score has no meaningful zero at all. Ask for a chart without answer-and-reader, and the model supplies a generic frame that answers nothing in particular.
Three Layers Where a Chart Lies
Layer 1 - The Baseline
A bar communicates by length measured from zero. Cutting the axis does not merely exaggerate the drawing: it breaks the channel, because the visual quantity no longer equals the data quantity. This is not a matter of taste - the UK Government Analysis Function guidance on charts states that the numeric axis should not be broken on bar charts.
The asymmetry with lines is the part prompts get wrong. A line is read by position, not length, so a truncated axis there can be a defensible choice - provided it is labelled. The rule that goes into the prompt: bars from zero, and if you cut an axis, say so on the chart itself.
Layer 2 - The Denominator
"Up 40%" names no base. A rate without an n cannot be audited, and duplicates or NULLs move the count without breaking anything visible. Getting that number right is a separate problem, covered in how to get queries you can actually trust; today assume the number is correct and look at what the drawing does with it. Ask for the denominator and the sample size to be printed on the chart, not buried in a footnote.
Layer 3 - The Relationship
The chart type is an assertion, not a preference. Bars compare magnitudes, lines show change over time, scatter plots suggest correlation, histograms show distribution, sorted bars rank. The Financial Times Visual Vocabulary sorts chart types into families by the relationship they are built to show: deviation, correlation, ranking, distribution, change over time, magnitude, part-to-whole, spatial and flow. If you do not declare the relationship, the default declares one for you.
Four Defaults That Turn a Correct Number Into a False Claim
The Pie
An angle is compared with nothing. Without a shared scale the eye cannot reliably compare two slices, and in the empirical hierarchy of encodings from Cleveland and McGill (1984) position on a common scale is read most accurately, followed by length, then angle, area, volume and colour saturation last. A pie with six categories is not a chart. It is a list with decoration around it.
The Twin Axis
Two scales in one frame make the crossing point an artifact of how those two scales were chosen, not a fact about the data. If the moment two series cross actually matters, index both to 100 and say that you did. Otherwise the chart is inviting a reader to find meaning in your axis configuration.
The Chosen Window
Where the series starts decides the story it tells. Choose the window by the cycle of the business - month, quarter, season - and declare it in the title, rather than choosing the window where the trend looks strongest.
3D and the Decoration
Volume and perspective deform the only channel that was exact. No 3D, no shadows falling across the data, no gradients competing with the bars. Colour belongs at the end of the hierarchy, for grouping and redundancy, not at the beginning as the main carrier of meaning.
The Six-Field Chart Contract
None of the above is fixed by retouching the image afterwards. It is fixed by declaring the decisions before anything is drawn. This block goes inside the prompt, in six fields:
QUESTION: what region grew most between January and June? RELATION: comparison (magnitude across regions) ENCODING AND BASELINE: bars from zero; if the axis is cut, mark it on the chart; no twin axes LABELS: currency, period and sample size (n) visible on the chart, not only in captions COMPARISON: against the previous period, the target, or a peer - name which one HONESTY RULE: list every decision you made that I did not specify, and if the data does not support the chart I asked for, say so instead of drawing it
The sixth field does the real work. It converts an invisible default into a reviewable sentence, and it gives the model permission to refuse the request. A chart request that cannot be refused will always be drawn.
The Baseline Test
Two checks on the chart you already have, both cheap.
Redraw at Zero
Regenerate with the axis at zero, or with the full window. If the conclusion changes, the chart was the argument, not the evidence.
One Sentence, No Picture
Write down in one line what the chart claims, and read that sentence alone. If the sentence is stronger than the numbers can support, the drawing is the part that lies.
| What the picture claims | The channel it uses | The check that catches it |
|---|---|---|
| A is twice B | Length | Baseline: redraw at zero |
| We are growing | Position | Window: redraw with the full period |
| These two move together | Position on two scales | Index both series to 100 |
| This share is big | Angle or area | Replace with a table or sorted bars |
Two Prompts That Draw the Chart, and the Half Neither Owns
The Script That Draws It
The Python data analysis script prompt asks for an executable script rather than a picture: describe the analysis - load the CSV, group by region and month, output a pivot table and a bar chart - and it returns commented steps, robust reading (missing values, normalized column names, detected types), a saved PNG chart, a CSV, a small sample fixture of five to ten rows, and edge cases such as an empty dataframe or a division by zero.
That is precisely where the contract goes: in the description field of the request. And the fixture is what makes the baseline test repeatable, because you can re-run it on ten fake rows without touching production data.
The Number Behind the Picture
The SQL query and schema builder prompt owns the second layer through its edge-case field: NULLs, duplicates, timezones and empty tables, with an explicit note on how the query handles each one. Duplicates inflate a count, NULLs silently drop rows, and a timezone moves an event across midnight into another day.
Both prompts are strong on the number and the code. Neither one knows who will read the chart or where your zero is - that is the first, second and fifth field of the contract, and it is yours to write.
Start with the data analysis script prompt when the chart has to be reproducible, and add the SQL and schema builder prompt when the figure comes from a query you did not write yourself. Paste the six fields above into whatever you use, and run the baseline test before the chart reaches anyone who will act on it.
LikePrompts Editorial
Practical guides for getting the most out of AI prompts — written by the LikePrompts team.