Skip to content

Review single-panel charts against ten visualization books

Run xpd charts <paths> to audit single-panel statistical charts in Python (Plotly, Matplotlib, Seaborn, pandas) and JavaScript and TypeScript (react-plotly.js, plotly.js) against 110 chart principles from the shared presentation catalog (rules/xpd/present.yml). Presentation tables belong to xpd tables, multi-panel layouts, maps, networks, hierarchies, flows, and report narrative belong to xpd views, and xpd present triages all presentation tracks together.

The chart gallery compares Plotly charts before and after applying each chart principle, with book, severity tier, and live color-vision deficiency filters.

Python and TSX filesDetect figures and run staticchart checksOptional --adapter (.py orJSON command)Measure 13 runtime facts inRustTiered mechanical findingledger + per-figure checkliststart -> plan -> gate ->finish
  1. Start with xpd charts start <paths>. Add --check "<tests>" to run your tests or --adapter "<adapter>" to measure figures.
  2. Inspect mechanical findings and remaining per-figure checklist items with xpd charts <paths> [--adapter "<adapter>"] --format json.
  3. Plan ordered fixes (mechanical finding IDs or "goal": "design" with "questions"), "accepted" exceptions, and "answered" checklist verdicts with xpd charts plan plan.json.
  4. Commit one fix at a time and verify each commit with xpd charts gate <fix-id>.
  5. Close the run with xpd charts finish once no open fix, unexplained new finding, or unanswered checklist item remains.
sales.py
import plotly.express as px
def sales_pie():
return px.pie(
names=["North", "South", "East", "West"],
values=[40, 30, 20, 10],
title="SALES BY REGION",
)
def price_line(years, prices):
return px.line(x=years, y=prices, labels={"x": "Year", "y": "Price in euro"})
Terminal window
$ xpd charts sales.py --format text
xpd charts: 6 findings (0 wrong, 3 bad, 3 ugly) in 1 file (1 Python, 0 JS/TS), 2 figures, 136 checklist items
Note: static-only scan; pass --adapter to run runtime checks (CVD color, banking, density, typography, and axis ranges).
Libraries: plotly
Figures:
93105f40 sales.py:5 px.pie (pie in plotly, route: go.Table, or px.bar sorted by value)
601c5b7b sales.py:13 px.line (line in plotly, route: px.line)
...
pie-chart [bad]: 1
ac99a33d sales.py:5 `plotly/pie-chart`: A pie chart puts no numbers along a common scale, so the reader compares angles. Tufte writes that pie charts should never be used and that a table is nearly always better. Show the shares as a sorted px.bar, or as a go.Table when they are few (Tufte 2001 p. 178).
...
Checklist: 136 items
93105f40/show-the-data sales.py:5 (pie in plotly) (Show the data, Tufte 2001, page 13) Does the chart show the observations themselves, avoiding cosmetic spline interpolation while overlaying any statistical trend smoother (such as LOESS or OLS) as a separate trace?
...

Create a Python adapter exposing figures() -> dict[str, object] (or a shell command printing {"figures": [...]} JSON for JavaScript and TypeScript Plotly and AG Grid components) and pass --adapter. xpd extracts specs for Plotly, AG Grid, and Matplotlib and runs all 14 runtime fact analyzers in Rust.

prices.py
import matplotlib.pyplot as plt
def price_chart():
fig, ax = plt.subplots(figsize=(4, 9))
ax.plot([2019, 2021], [20.0, 35.0], color="red", label="North")
ax.plot([2019, 2021], [18.0, 30.0], color="green", label="South")
ax.set_title("PRICE BEFORE AND AFTER THE 2020 POLICY")
ax.set_ylabel("Price in euro")
ax.legend()
return fig
figures.py
from prices import price_chart
def figures():
return {"prices": price_chart()}
Terminal window
$ xpd charts prices.py --adapter figures.py --format text
xpd charts: 14 findings (3 wrong, 6 bad, 5 ugly) in 1 file (1 Python, 0 JS/TS), 2 figures, 140 checklist items
Libraries: matplotlib
Figures:
7be371d4 prices.py:6 ax.plot (line in matplotlib, route: px.line)
83fe2393 prices.py:7 ax.plot (line in matplotlib, route: px.line)
Adapter `figures.py` measured 1 figure: prices
...
cvd-collision [bad]: 1
ebcf89ad figures.py [prices] `North` and `South` collapse under protanomaly with no direct labels (Wilke 2019 p. 238).
...
vertical-aspect-ratio [bad]: 2
ec016cc1 figures.py [prices] Single-panel canvas 400 by 900 px is taller than wide (Tufte 2001 p. 186).
...
Runtime fact What it measures Mechanical defects flagged
canvas Pixel width, height, and panel count Single panel taller than wide
values Plotted value count, pie slices, and bar ordering 4 or fewer unlabeled values, pie charts, alphabetical category ordering, mixed zeros and nulls
colors Trace colors, line dashes, widths, and direct labels Thick line strokes, missing direct labels
color-cvd Machado CVD pairwise OKLab distances, palette size, fill chroma, custom colorscale luminance, and legend order Deuteranomaly, protanomaly, or tritanomaly collisions, more than 8 colors, oversaturated fills, non-monotonic colorscales, legend order mismatch
distributions Multi-histogram stacking or overlap, KDE boundary bounds, violin sample counts, and scatter overplotting Stacked or overlapping histograms, KDE leakage below zero, sparse violins under 15 points, opaque overplotted scatters
uncertainty Error bar interval labeling and bar-plus-error-bar dynamite plots Unlabeled error bars without SD, SE, CI, or credible basis, dynamite plots
typography Axis tick and title font sizes relative to canvas width and compound-panel color consistency Tiny axis labels under 9 px or 1% of width, conflicting series colors across panels
x-values Plotted x values and year span Two isolated years with no context, multi-year undeflated currency
text Titles, axis titles, tick angles, and data-bound annotations All-caps titles, rotated ticks, edge-clipping or overlapping direct labels
axes Axis ranges, log bars, axis-edge points, map projections, overlaying secondary axes, explicit ticks, and frames Non-zero bar or area baselines, log-scale bars, scatter points on axis edges, non-equal-area choropleths, dual axes, excess ticks, boxed frames
banking Median absolute visual slope per subplot panel Aspect ratios far from banking to 45 degrees
table-numbers Numeric formatting, header and cell alignment, and zero versus missing values Unformatted decimals, misaligned headers or numeric cells, mixed zeros and nulls
table-structure Row count, topical grouping, header clarity, and row ordering Raw or all-caps headers, alphabetical row order, more than 12 flat rows

Run xpd charts create to make a new chart as a durable run in which xpd owns the order of work. You declare the chart in a JSON spec, and xpd routes, scaffolds, renders, measures, and gates it. Run xpd charts create forms to list the forms with their reader tasks and column roles. For the proportions task, the pie form sums values by category and labels each bar with its share of the total.

edit the fileSpec: message, task, data,column rolesRoute the task to a formScaffold the file in thehouse styleRender a page and ascreenshotMeasure findings and factsAnswer scoped questionswith measured factsFinish
revenue.json
{
"name": "revenue_by_region",
"message": "North earns twice the revenue of West",
"task": "amounts",
"data": "data/revenue.csv",
"columns": {"category": "region", "value": "revenue"},
"labels": {"region": "Region", "revenue": "Revenue in million euro"},
"source": "Source: finance ledger, 2026.",
"output": "figures/revenue_by_region.py"
}
Spec key What it declares What xpd checks
name Python function name of the figure snake_case, and not figures
message The one sentence a reader should take away, used as the headline 15 to 110 characters, sentence case, at least three words
task The reader task One of the tasks printed by create forms
data A .csv or .parquet file inside the project The file exists, and a CSV holds every bound column
columns Each column role of the form bound to a column Exactly the roles of the form
labels A reader-facing label with its unit for each drawn column Present, and no raw identifier or all capitals
source The source note under the figure At least 8 characters
output The Python file to scaffold A .py path inside the project that does not exist yet
width, height, form, form_reason Optional canvas size in pixels (default 800 by 450) and an explicit form A form outside the candidates of the task needs form_reason
  1. Run xpd charts create start revenue.json. When only one form of the task fits the declared columns, xpd scaffolds it at once. Otherwise the run stops at routing and names the candidates for xpd charts create route <run> --form <form>.
  2. Open the page or the screenshot the run prints and look at the chart before you read its code. The screenshot needs a browser on PATH. An agent host with html_preview and html_render, such as T3 Code, reads the page without one: the page keeps the figure at its declared size and scales it down in a narrower frame.
  3. Edit the file when a finding or the picture calls for it, then run xpd charts create render <run>. A changed file voids the recorded answers.
  4. Write answers.json and run xpd charts create answer <run> answers.json. Each answer names what you saw in at least 25 characters, and an answer to a question that lists measured facts must cite one in fact. Core principles cannot be answered na, and a finding stays open until it is fixed or listed under accepted with a reason.
  5. Run xpd charts create finish <run>. It fails while the file differs from its last render, while the file draws another form than the run routed to, or while a finding or question is open.
answers.json
{
"answers": [
{"question": "labels", "verdict": "pass", "fact": "text",
"reason": "The headline states the takeaway and the value axis reads Revenue in million euro."},
{"question": "order", "verdict": "pass",
"reason": "Bars are sorted by revenue with North at the top and Islands at the bottom."}
],
"accepted": []
}

The run asks only the core principles of xpd charts and the questions of the declared task, 13 for this bar chart against 67 in a full review. Rendered pages are written under $XDG_STATE_HOME/xpd/create/, and a screenshot is added when chrome, google-chrome, chromium, or chromium-browser is on PATH.

Run xpd charts --questions --format json (with optional --book <book> and --tier wrong|bad|ugly) to inspect all 110 chart principles from rules/xpd/present.yml with book citations, severity tiers, check modes (mechanical, hybrid, judgment), figure kinds, runtime facts, and linked plotly rules.

Terminal window
$ xpd charts --questions --format json | jq -r '.questions[] | "page \(.page), \(.id), \(.principle): \(.text)"'
page 13, show-the-data, Show the data: Does the chart show the observations themselves, avoiding cosmetic spline interpolation while overlaying any statistical trend smoother (such as LOESS or OLS) as a separate trace?
...
page 57, lie-factor, The Lie Factor: Is the size of each mark proportional to its number? Divide the size of an effect in the chart by its size in the data; a Lie Factor outside 0.95 to 1.05 is a distortion.
...
page 129, paired-data-diagonal, Plot paired measurements against a y = x diagonal: When comparing two matched measurements in identical units (such as before versus after), does a scatter plot with equal axis limits and a y = x line show shifts more clearly than paired bars?
...