One CSV, two themes, zero config

dstory.draft() profiled mix.csv, picked the scenes, mapped the columns onto cookbook recipes and wrote every headline from computed facts. Each number in the prose is a registered claim the vetter checks. The same draft is built in two themes below.

warm-printOpen the story data-fiOpen the story

The code

import pandas as pd, dstory

df = pd.read_csv("mix.csv")            # year, source, share_pct
d = dstory.draft(df, title="Gas took coal's place", theme="warm-print",
                 source="Illustrative power-mix shares (synthetic data)")
print(d.explain())
dstory.build(d.story, "mix", scenes=d.scenes, vet=True)

# or, with no Python at all:
#   dstory draft mix.csv --theme warm-print --source "Illustrative power-mix shares (synthetic data)"

What explain() said

Profile: 44 rows x 3 columns, long format
  year: temporal (11 distinct, year)
  source: categorical (4 distinct)
  share_pct: measure (19 distinct, averaged when rows repeat)
Scenes:
  1. scene-trend: line-reveal over year x share_pct -- time series detected; share_pct is a share, compared in percentage points, so it follows the largest source in 2024 (Gas)
  2. scene-panels: small-multiples of share_pct by source over year -- 4 source values; one shared scale
  3. scene-shift: slope-chart of source, 2014 vs 2024 -- category x first/last period (4 source values present in both)
  4. scene-race: bump-chart of source rank by share_pct -- the top source changed (Coal in 2014, Gas in 2024)
  5. scene-mix: waffle of source by share_pct in 2024 -- share_pct sums to ~100 per year
Claims (6), each checked by the vetter:
  c-trend: Gas share rose 16 points between 2014 and 2024
  c-trend-step: The sharpest move came in 2015, when it rose 6 points from 2014.
  c-shift: Coal share fell 24 points between 2014 and 2024, the biggest shift of any source
  c-shift-contrast: Renewables share, by contrast, rose 8 points.
  c-mix-lead: In 2024, Gas holds the largest share: 43%
  c-mix-next: Renewables is next, at 23%.

A messy export, with an animated opener

generation.csv looks like a real spreadsheet export: every number is text with thousands separators ("410,000"). draft() reads the column as numbers and says so (a cell it can't read would be dropped and named). Because generation adds up across sources, the story opens with an animated Vizzu chart: the total as stacked bars, which morph into one line per source as you scroll.

editorial-noirOpen the story
dstory draft generation.csv --source "Illustrative generation by source (synthetic data)"
Profile: 40 rows x 3 columns, long format
  year: temporal (10 distinct, year)
  source: categorical (4 distinct)
  gwh: measure (33 distinct, summed when rows repeat)
  (cleaned) gwh: read as numbers
Scenes:
  1. scene-opener: vizzu opener, gwh stacked by source per year, then one line per source -- time series detected; gwh is additive, so the total stacks by source
  (skipped) small-multiples: the opener already shows one line per source.
  2. scene-shift: slope-chart of source, 2015 vs 2024 -- category x first/last period (4 source values present in both)
  3. scene-race: bump-chart of source rank by gwh -- the top source changed (Coal in 2015, Gas in 2024)
  (skipped) waffle: gwh is not a share (per-year totals are not ~100 or ~1).
Claims (6), each checked by the vetter:
  c-trend: Total gwh rose 29% between 2015 and 2024
  c-trend-step: The sharpest move came in 2024, when it rose 3.9% from 2023.
  c-opener-lead: In 2024, Gas made up 38% of the total
  c-opener-next: Solar was next, at 23%.
  c-shift: Solar rose 12-fold between 2015 and 2024, the biggest shift of any source
  c-shift-contrast: Coal, by contrast, halved.

Eight markets, eight sizes: small multiples and range-dots

metros.csv has home sales for 8 metros, from Phoenix (about 90,000 a year) to Fargo (about 3,400). On one shared scale the small markets would be flat lines along the floor, so draft() gives each panel its own scale, labels it, and tells the reader to compare shapes, not heights. Eight categories are too many for slope-chart labels, so the before/after scene is a range-dots chart. This one is built with --vendor: it works with no network at all.

minimal-light, offlineOpen the story
dstory draft metros.csv --vendor --theme minimal-light
Profile: 72 rows x 3 columns, long format
  year: temporal (9 distinct, year)
  metro: categorical (8 distinct)
  homes_sold: measure (61 distinct, summed when rows repeat)
Scenes:
  (skipped) vizzu opener: needs 2-7 metro values in every year and 3-20 periods (found 8 and 9).
  1. scene-trend: line-reveal over year x homes_sold -- time series detected; homes_sold summed across metro per year
  2. scene-panels: small-multiples of homes_sold by metro over year -- 8 metro values; the largest panel is 10x or more the smallest, so each has its own scale
  3. scene-shift: range-dots of metro, 2016 vs 2024 -- category x first/last period (8 metro values present in both; range-dots past 7, where slope labels collide)
  (skipped) bump-chart: the top metro did not change (Phoenix leads in both 2016 and 2024).
  (skipped) waffle: homes_sold is not a share (per-year totals are not ~100 or ~1).
Claims (4), each checked by the vetter:
  c-trend: Total homes sold rose 5.9% between 2016 and 2024
  c-trend-peak: It peaked in 2021, then fell 21% by 2024.
  c-shift: Phoenix rose 14% between 2016 and 2024, the biggest shift of any metro
  c-shift-contrast: Denver, by contrast, fell 3.8%.

Every chart ships its data

Open any story above and look under a chart: a collapsed Data panel holds an accessible table of the exact rows behind it, and a Download CSV link that works offline. Nobody wrote either: the bundler adds them to every scene with a dataset, and the vetter checks in a browser that each table and CSV match data.json. In slides mode, press t. Turn them off per scene with "a11y": {"table": false}, or for a whole bundle with dstory bundle --no-a11y-extras.

Every chart reads out loud

Press Tab until a chart is outlined, in any story above. A readout summarises it (for the metros: each city, from where it started to where it ended, and where it peaked). Then ← → step through the points (“2019: homes sold 10.8 (Boise), 4 of 9”), ↑ ↓ switch series at the same date, Home and End jump to the ends, and Esc hands the keys back. The same text goes to screen readers through an aria-live region. It reads the data, not the drawing, so it works for recipes, hand-written D3 and Vizzu alike, and the vetter presses the keys to check it. Turn it off with "a11y": {"explorer": false}.

Every chart can be heard

Press ▶ Listen beside any chart’s Data panel. For the metros, each city plays in turn as a run of tones: the pitch climbs to 2021’s peak and falls back, and the sound moves left to right through the years. Each city is named before it plays. With a chart focused, L plays just the city you are on. It is Web Audio inside the HTML file, never autoplays, and the vetter checks that a higher value is never a lower note. Turn it off with "a11y": {"sonify": false}.