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.
Review workflow
Section titled “Review workflow”- Start with
xpd charts start <paths>. Add--check "<tests>"to run your tests or--adapter "<adapter>"to measure figures. - Inspect mechanical findings and remaining per-figure checklist items with
xpd charts <paths> [--adapter "<adapter>"] --format json. - Plan ordered fixes (mechanical finding IDs or
"goal": "design"with"questions"),"accepted"exceptions, and"answered"checklist verdicts withxpd charts plan plan.json. - Commit one fix at a time and verify each commit with
xpd charts gate <fix-id>. - Close the run with
xpd charts finishonce no open fix, unexplained new finding, or unanswered checklist item remains.
Review static code
Section titled “Review static code”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"})$ xpd charts sales.py --format textxpd charts: 4 findings (0 wrong, 1 bad, 3 ugly) in 1 file (1 Python, 0 JS/TS), 2 figures, 136 checklist itemsNote: static-only scan; pass --adapter to run runtime checks (CVD color, banking, density, typography, and axis ranges).Libraries: plotlyFigures: 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?...Measure rendered figures with --adapter
Section titled “Measure rendered figures with --adapter”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.
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 figfrom prices import price_chart
def figures(): return {"prices": price_chart()}$ xpd charts prices.py --adapter figures.py --format textxpd charts: 13 findings (3 wrong, 5 bad, 5 ugly) in 1 file (1 Python, 0 JS/TS), 2 figures, 140 checklist itemsLibraries: matplotlibFigures: 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 |
List all chart principles
Section titled “List all chart principles”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.
$ 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?...