xpd charts
Use xpd charts when you make, change, or review single-panel statistical charts in Python (Plotly, Matplotlib, Seaborn, pandas) or JavaScript and TypeScript (react-plotly.js, plotly.js). Presentation tables belong to xpd tables, and multi-panel layouts, maps, networks, hierarchies, flows, and report narrative belong to xpd views. Use xpd present to triage all presentation tracks together. The chart review guide shows how to run static audits, runtime adapters, and recorded review loops.
| Group | What it measures | Example kinds |
|---|---|---|
| Graphical integrity | Distortions of scale, baseline, dimensions, money, or context | non-zero-baseline, dual-axis, log-scale-bars, undeflated-money, missing-context |
| Distributions and uncertainty | Variation, error bars, density bounds, and overplotting | unlabeled-error-bars, dynamite-plot, stacked-or-overlapping-histogram, kde-boundary-leak, sparse-violin, overplotted-scatter |
| Data-ink and chartjunk | Non-data frames, grids, patterns, and software chrome | default-template, boxed-frame, heavy-grid, redundant-color, pattern-fill, oversaturated-fill |
| Encoding and form | Weak chart types, unordered palettes, smoothing, and ordering | pie-chart, small-data-chart, rainbow-colorscale, cvd-collision, too-many-colors, alphabetical-order |
| Words and layout | Legends, labels, typography, aspect ratio, and slope banking | legend-instead-of-labels, legend-order-mismatch, data-on-axis-line, tiny-axis-labels, poor-banking |
xpd charts [OPTIONS] [PATHS]... xpd charts <COMMAND>Subcommands
Section titled “Subcommands”| Subcommand | What it does |
|---|---|
xpd charts start |
Start a run: record the commit it starts from, the paths, line count, checks and optional benchmark of the project |
xpd charts plan |
Record the plan of a round: the fixes in order, and the findings that are right as they are |
xpd charts approve |
Record that the user said yes to a fix that changes what callers or users see |
xpd charts gate |
Gate a fix that is committed: run the checks, time --bench when set, count lines and compare the findings with the commit before it. Exit 1 when the fix is not kept |
xpd charts drop |
Record that a fix was given up, after its files were restored |
xpd charts status |
Print the run and the stage that comes next |
xpd charts finish |
End the run: compare findings, line count and benchmark timing with the start commit. Exit 1 while a fix is open or a new finding has no reason |
Arguments
Section titled “Arguments”| Argument | What it does |
|---|---|
<PATHS>... |
Files or directories (directories respect .gitignore) |
Options
Section titled “Options”| Option | Default | What it does |
|---|---|---|
--kind <KIND> |
List only the findings of these kinds, separated by commas. Repeatable. Values: non-zero-baseline, dual-axis, extra-dimensions, distorted-size, undeflated-money, missing-context, log-scale-bars, unlabeled-error-bars, dynamite-plot, stacked-or-overlapping-histogram, kde-boundary-leak, sparse-violin, overplotted-scatter, default-template, boxed-frame, heavy-grid, redundant-color, pattern-fill, decorative-gauge, heavy-box-plot, thick-line, pie-chart, small-data-chart, rainbow-colorscale, cvd-collision, too-many-colors, oversaturated-fill, smoothed-data, excess-ticks, alphabetical-order, zero-missing-ambiguity, legend-instead-of-labels, legend-order-mismatch, label-collision, data-on-axis-line, column-name-label, rotated-ticks, all-caps-text, tiny-axis-labels, vertical-aspect-ratio, poor-banking, legend-inside-plot, missing-labels. |
|
--limit <LIMIT> |
20 |
The most findings to list of each kind, strongest first. 0 lists every finding. |
--since <COMMIT> |
Count the findings at this commit too, and print each count beside the count of today. | |
--group-by <GROUP_BY> |
none |
Group findings and checklist items by owning module or shared cause. Values: none (Keep the default flat per-kind listing), module (Group findings and checklist items by owning module path), cause (Group related findings by shared kind and anchor files). |
--packet <N> |
Emit one 1-indexed deterministic context-budgeted review packet for the Nth cluster. | |
--budget-lines <LINES> |
300 |
Maximum source lines included across excerpts inside a --packet view. |
--all-modules |
Include checklist review items for every surveyed module, not only modules with findings. | |
--format <FORMAT> |
Output format. Default: text on a terminal, json otherwise. Values: text, json. |
|
--adapter <ADAPTER> |
A Python adapter file or shell command that emits rendered figure specs for runtime checks. | |
--questions |
Print the inventory of xpd charts questions and runtime facts, with no file scan. |
|
--book <BOOK> |
Filter questions and checklist items to principles citing these books (comma-separated keys of books in rules/xpd/present.yml, such as tufte,wilke) Repeatable. |
|
--tier <TIER> |
Filter findings and checklist items to these Wilke severity tiers (comma-separated) Repeatable. Values: wrong (Mathematical or scale distortion that misstates the data), bad (Perceptual or clarity failure that impedes accurate decoding), ugly (Aesthetic or chrome flaw that leaves the data readable). |
Examples
Section titled “Examples”import matplotlib.pyplot as pltimport seaborn as sns
def revenue(frame): fig, ax = plt.subplots() sns.barplot(frame, x="region", y="revenue", ax=ax) return fig$ xpd charts report.py --format json | jq -c '{libraries: .read.libraries, figures: [.read.figures[] | {call, kind, library, line}], checklist: (.checklist | length)}'{"libraries":["matplotlib","seaborn"],"figures":[{"call":"sns.barplot","kind":"bar","library":"seaborn","line":7}],"checklist":70}--adapter <adapter.py or command> adds runtime measurements of rendered figures. A Python adapter defines figures(), which returns a dict of name to figure (go.Figure or Matplotlib Figure), and runs in the project's Python. A shell command adapter prints {"figures": [...]} JSON on stdout for JavaScript and TypeScript Plotly specs.
import pandas as pd
from report import revenue
def figures(): frame = pd.DataFrame({"region": ["North", "South", "West"], "revenue": [9.0, 6.0, 4.0]}) return {"revenue": revenue(frame)}$ xpd charts report.py --adapter report_figures.py --format json | jq -c '[.findings[] | select(.places[0].path == "report_figures.py") | {kind, evidence}]'[{"kind":"undeflated-money","evidence":"[revenue] Figure shows money (`revenue`) without nominal, real, or constant basis (Tufte 2001 p. 68)."},{"kind":"boxed-frame","evidence":"[revenue] Matplotlib axes keep all four box spines visible. Hide top and right spines (`ax.spines[['top', 'right']].set_visible(False)`) (Tufte 2001 p. 96)."},{"kind":"small-data-chart","evidence":"[revenue] Figure draws only 3 values (4 or fewer), which a table or sentence shows better (Tufte 2001 p. 33)."}]With --questions, it prints the 13 runtime facts that chart principles read and all 110 chart principles (filterable with --book and --tier).
$ xpd charts --questions --format json | jq '{facts: (.facts | length), questions: (.questions | length)}'{ "facts": 13, "questions": 110}A recorded run
Section titled “A recorded run”Record review rounds in .git/xpd-charts.json (or .git/xpd-ledger.sqlite in durable mode) so xpd gates every commit on checks, mechanical finding counts, and per-figure checklist completion.
Judgment-based improvements with no mechanical finding ID may set "goal": "design" with "questions": ["<figure-id>/<question-id>"] in the plan. Use start, plan, approve, gate, drop, status, and finish to drive each stage.
Exit status
Section titled “Exit status”| Exit code | Meaning |
|---|---|
0 |
Ledger printed or run stage succeeded |
1 |
Gate rejected a change or finish blocked on open fixes, new findings, or unanswered checklist items |
2 |
Command could not run (for example, missing file or invalid --since commit) |