Kavya Subramanian has a rule for the graphics she builds at The Long Room: before a chart goes out, she covers the title with her thumb and asks a colleague what the chart says. If the answer is wrong, the chart is wrong, however pretty it is.
In This Chapter
- Two charts, one chase
- 7.1 What a cricket chart is for
- 7.2 The Manhattan: which overs mattered?
- 7.3 The worm and the chase chart: who's ahead, and what's needed?
- 7.4 Partnership bars: who built the innings, and with whom?
- 7.5 Heat maps: two dimensions at once
- 7.6 Small multiples: many matches, one glance
- 7.7 Control charts: is this season really different?
- 7.8 Spider charts: the profile, and its problems
- 7.9 Wagon wheels, pitch maps and beehives: the charts we cannot draw from public data
- 7.10 Designing for the reader: colour, annotation and the phone screen
- Spaced Review
- Project Checkpoint: charts
- Chapter Summary
- What's Next
Chapter 7 — Visualizing Cricket: Manhattans, Worms, Wagon Wheels, Pitch Maps, and Charts That Tell the Story of a Match
Two charts, one chase
Kavya Subramanian has a rule for the graphics she builds at The Long Room: before a chart goes out, she covers the title with her thumb and asks a colleague what the chart says. If the answer is wrong, the chart is wrong, however pretty it is.
She is testing two charts of the same match on Nusrat Jahan, who has dialled in from Dhaka on a connection that keeps freezing her face mid-sentence. The match is one this book will keep returning to: South Africa against Sri Lanka, the third T20 International at Newlands, Cape Town, on 25 January 2017. South Africa batted first and made 169 for 5. Sri Lanka chased 170.
The first chart is a worm: two lines climbing from zero, one per innings, showing cumulative runs ball by ball. Kavya stops it after 15 overs of the chase.
"Who's winning?"
Nusrat squints. "Nobody? The lines are on top of each other. Sri Lanka are 116 for 2, South Africa were... about the same."
She is right about the lines. In the book's data, South Africa were 119 for 3 after 15 overs; Sri Lanka were 116 for 2. After ten overs Sri Lanka had actually been ahead of South Africa's pace, 81 to 79. After fourteen they were ahead again, 114 to 109. On the worm, this chase looks like a dead heat with a wicket in hand.
Then Kavya shows the second chart: the run-rate chart for the chase. An orange line shows Sri Lanka's scoring rate so far; a black dashed line shows the rate they need from here. At the end of over 15 the orange line sits at 7.73 runs an over. The black line sits at 10.80. Sri Lanka need 54 off the last 30 balls.
"Oh," says Nusrat. "That's not a dead heat at all."
It isn't. Both charts are drawn from the same 244 deliveries, and both are correct. They answer different questions. The worm answers how does this innings compare with the other one at the same point? South Africa had scored 50 of their 169 runs in the last five overs, 21 of them in the final over alone, so "level with South Africa after 15" meant "behind a total that was back-loaded". The run-rate chart answers what does the batting side need from here? — and from here, Sri Lanka needed nearly 11 an over.
Then over 16 happened. Imran Tahir bowled it: two runs, two wickets — Niroshan Dickwella caught for 68 off 51 balls, Dhananjaya de Silva stumped for 19 off 27. Sri Lanka 118 for 4, needing 52 off 24. The required rate jumped to 13.00. And then, on the Manhattan — the bar chart of runs per over, named for the skyline it makes — the tallest orange tower of the night rose immediately after Tahir's over: 19 runs off Wayne Parnell in over 17, most of them to Seekkuge Prasanna, who finished 37 not out off 16 balls. Sri Lanka won with a ball to spare.
Three charts, three different stories, one match. That is this chapter. Cricket has its own chart repertoire — Manhattans, worms, wagon wheels, pitch maps, beehives — built over decades by broadcasters and scorers. Some of those charts are excellent at one job and misleading at others. Some, like the pitch map and wagon wheel, need data that is not public, and we will have to be honest about that. And some of the most useful charts for cricket analytics — heat maps, small multiples, control charts — never appear on television at all.
By the end of the chapter you will have a module, crease.charts, that draws all of them in one line each, and every later chapter of this book will import it.
🏏 Fan Track: Read the prose and study the figures; skip the code blocks. Sections 7.2–7.4 teach you to read the three classic match charts properly; 7.9 tells you what Hawk-Eye graphics on television do and don't show; 7.10 is a short guide to spotting a misleading chart.
📊 Analyst Track: Run all seven scripts in
code/and the checkpoint. Read 7.1 (choosing a form) and 7.10 (colour and annotation) closely — they are the difference between a chart that looks finished and one that is right. Every later chapter's figures use the functions you build here.🎰 Betting Track: Sections 7.3 and 7.7 matter most to you: the run-rate chart is the visual form of the in-play question "what does the batting side need from here?", and the control chart is how you tell a genuine shift in scoring (a market that hasn't caught up) from ordinary season-to-season noise.
7.1 What a cricket chart is for
Start with the cricket question, not the chart type. Every chart in this chapter exists because somebody — a captain, a commentator, a selector, a fan on a bus — had a question that a table of numbers answered slowly and a picture answered quickly.
| The question | The chart | What it encodes |
|---|---|---|
| Which overs were expensive? When did wickets fall? | Manhattan | runs per over as bar height; wickets as marks |
| How do the two innings compare at the same point? | Worm | cumulative runs as a line against overs |
| What does the chasing side need from here? | Run-rate chart | current and required run rate per over |
| Who built the innings, and with whom? | Partnership bars | runs per stand, split by batter |
| Where does a batter score? | Wagon wheel | shot direction and distance |
| Where does a bowler land the ball? | Pitch map | where each delivery bounced |
| Where does the ball arrive at the batter? | Beehive | position as the ball passes the stumps |
| How does a rate vary across two dimensions? | Heat map | colour in a grid |
| How do many matches or players compare? | Small multiples | the same small chart, repeated on shared axes |
| Is this season genuinely different, or just noise? | Control chart | a series against limits of ordinary variation |
| How does a player profile across several skills? | Spider / radar | several metrics on radial axes |
That table is the chart repertoire this chapter teaches. The right-hand column is the important one, because a chart is a set of encodings — decisions about which visual property carries which number — and some encodings are read far more accurately than others.
📐 Definition — Encoding: the mapping from a number to a visual property of a mark: position along an axis, length of a bar, angle of a slice, area of a circle, colour intensity. A chart's accuracy depends mostly on which encodings it uses for the comparisons the reader needs to make.
The most influential evidence on this comes from William Cleveland and Robert McGill's experiments on graphical perception in the 1980s. People judge position along a common scale most accurately, then position on separate but aligned scales, then length, then angle and slope, then area, then colour saturation and hue. The practical rule for cricket charts is simple: put the comparison that matters on a common axis. A Manhattan puts both teams' runs-per-over on the same vertical scale, so you compare bar heights directly. A pie chart of "runs by phase" asks you to compare angles, which you do badly. A heat map asks you to compare colours, which you do worst of all — which is why the heat maps in this chapter print the number inside every cell.
Edward Tufte supplied the second principle: data-ink. Of all the ink (or pixels) in a chart, how much is spent showing data, and how much on frames, shadows, gridlines, 3-D effects and decorative logos? Tufte's advice is to maximise the share spent on data, within reason. It is not a law — a little non-data ink, such as a light grid or a label, helps the reader — but it is a good test. When Kavya removes something from a graphic and nobody misses it, it was not data-ink.
📐 Definition — Data-ink ratio (Tufte): the proportion of a graphic's ink devoted to the non-redundant display of data. Raising it means removing chart furniture (heavy borders, 3-D bevels, background images, redundant legends) that carries no information.
The third principle is cricket's own: format-awareness. A Manhattan of a Test innings would have 130 bars and tell you almost nothing. A worm of a Test match needs to show four innings and a lead that changes hands. A heat map of "run rate by over" means one thing over 20 overs and another over 50. We will come back to this in every section, because the classic charts were built for one-day cricket and only partly transfers.
The book's chart conventions
Before we draw anything, here are the conventions every chart in this book follows. They are baked into crease.charts, so you get them for free.
- Colour by job, never by rank. The team batting first is always blue; the team batting second is always orange. Wickets are red and drawn as an "X", so colour is never the only cue. Dot balls are grey; boundaries are orange squares.
- Colour-blind-safe. Blue and orange separate well for the common forms of colour-vision deficiency. Red and green alone never carry a meaning. (Section 7.10 shows why, with numbers.)
- One axis. No chart in the book has two different y-scales. If two measures have different units, they get two charts.
- Overs are 1-based. Over 1 is the first over, as in every chapter.
- Simulated tracking is labelled. Any chart drawn from the simulated tracking layer says so in its title or caption: "simulated tracking layer — real outcomes, simulated locations".
- Annotate sparingly. One or two callouts that carry the story — "Tahir: 2 runs, 2 wickets" — not a label on every bar.
🔄 Check your understanding 1. A broadcaster shows "share of runs by phase" as a pie chart for each team. Using Cleveland's ranking of encodings, explain why a grouped bar chart or dot plot would be read more accurately. 2. What is "data-ink", and name one piece of non-data ink that is nevertheless worth keeping. 3. Why does the book colour the two innings blue and orange rather than, say, green and red?
Answer
- A pie encodes values as angles and areas, which people judge poorly; bars or dots encode them as lengths or positions on a common scale, which people judge most accurately. Comparing two teams' powerplay shares across two pies is especially hard because the slices are not aligned.
- Data-ink is the ink that shows the data itself (bars, lines, points, values). A light gridline or a short axis label is non-data ink that helps the reader locate values, so it earns its place; a 3-D bevel or a background photo does not.
- Because blue and orange stay distinct for the common forms of colour-vision deficiency, while red and green can become nearly indistinguishable; and because colour is assigned by job (batting first / batting second), it stays consistent across every chart in the book.
7.2 The Manhattan: which overs mattered?
The cricket question: which overs went for runs, which were tight, and when did the wickets fall?
The Manhattan is the most familiar chart in limited-overs cricket. Each over is a bar; the bar's height is the runs scored in that over, extras included. Wickets are marked above the bar of the over in which they fell. When both innings are shown, the bars sit side by side so you can compare the two teams over by over.
📐 Definition — Manhattan: a bar chart of runs conceded in each over of an innings (all runs, including wides, no-balls, byes and leg-byes), with each wicket marked on the over in which it fell. In this book wickets exclude retired hurt and retired not out.
Building the over table
Every match chart in this chapter starts from the same two steps: take one match's deliveries in order, and add a running clock and score. Here is the core of match_balls() and over_table() from crease.charts:
def match_balls(balls, match_id):
m = balls[(balls["match_id"] == str(match_id)) & (~balls["super_over"])]
m = m.sort_values("delivery_seq").copy()
m["is_dismissal"] = m["is_wicket"] & ~m["wicket_kind"].isin(NOT_DISMISSAL)
g = m.groupby("innings")
m["balls_done"] = g["is_legal"].cumsum() # legal balls bowled so far
m["score"] = g["runs_total"].cumsum() # running score
m["wkts"] = m.groupby("innings")["is_dismissal"].cumsum()
return m
def over_table(balls):
m = _prepared(balls)
t = (m.groupby(["innings", "over"])
.agg(batting_team=("batting_team", "first"), bowler=("bowler", "first"),
runs=("runs_total", "sum"), wickets=("is_dismissal", "sum"),
legal=("is_legal", "sum"))
.reset_index())
t["cum_runs"] = t.groupby("innings")["runs"].cumsum()
t["cum_wkts"] = t.groupby("innings")["wickets"].cumsum()
return t
Two pandas idioms are new here. groupby(...)["col"].cumsum() is a running total within each group: it adds up is_legal (True counts as 1) ball by ball, but restarts at zero for each innings. That gives every delivery a clock — "legal balls bowled so far in this innings" — and the same trick on runs_total gives the running score. .agg(name=(column, function)) is named aggregation: in one call it builds a table with one row per (innings, over) and the columns we name, each computed by the function we choose ("first", "sum"). You met groupby in Chapter 3; these are the two variations you will use most in match charts.
The script code/01_anchor_manhattan_worm.py builds the over table for Newlands and pivots it wide — one row per over, one column per innings — with pivot(index=..., columns=..., values=...), which reshapes a long table (one row per innings-over) into a grid:
ov = charts.over_table(m)
wide = ov.pivot(index="over", columns="innings", values=["runs", "wickets", "cum_runs", "cum_wkts"])
Over-by-over (innings 1 = South Africa, innings 2 = Sri Lanka)
runs_1 runs_2 wickets_1 wickets_2 cum_runs_1 cum_runs_2 cum_wkts_1 cum_wkts_2
over
1 10 9 0 0 10 9 0 0
2 12 9 0 0 22 18 0 0
3 5 6 0 0 27 24 0 0
4 8 12 0 0 35 36 0 0
5 1 9 1 1 36 45 1 1
6 12 3 0 1 48 48 1 2
7 7 7 0 0 55 55 1 2
8 5 5 0 0 60 60 1 2
9 13 13 0 0 73 73 1 2
10 6 8 0 0 79 81 1 2
11 9 4 0 0 88 85 1 2
12 10 10 0 0 98 95 1 2
13 9 7 0 0 107 102 1 2
14 2 12 1 0 109 114 2 2
15 10 2 1 0 119 116 3 2
16 5 2 0 2 124 118 3 4
17 11 19 1 0 135 137 4 4
18 6 7 1 1 141 144 5 5
19 7 15 0 0 148 159 5 5
20 21 11 0 0 169 170 5 5
Look how strange that table is. After six overs, both sides were 48. After seven, both were 55; after eight, both 60; after nine, both 73. For four consecutive overs, the two teams' scores were identical. You can see that in a table if you look hard. On a chart you see it instantly.
Drawing it
The drawing function puts the two innings side by side within each over and stacks one "X" per wicket above the bar:
def manhattan(balls, ax=None, innings=None, title=None, annotate=None, tick_step=1):
m = _prepared(balls)
t = over_table(m)
inns = innings or sorted(t["innings"].unique())
ax = _ax(ax)
width = 0.8 / len(inns)
for k, inn in enumerate(inns):
d = t[t["innings"] == inn]
x = d["over"] + (k - (len(inns) - 1) / 2) * width # side-by-side offset
ax.bar(x, d["runs"], width=width * 0.92, color=TEAM_COLOURS[inn], label=...)
for xi, r, w in zip(x, d["runs"], d["wickets"]):
for j in range(int(w)): # one X per wicket
ax.plot(xi, r + 1.2 + 1.6 * j, marker="X", color=OUTCOME_COLOURS["wicket"], ...)
...
In the script, one call draws the whole figure, with two callouts:
charts.manhattan(m, ax=ax, annotate={(2, 16): ("Tahir: 2 runs,\n2 wickets", -1.4, 17),
(2, 17): ("19 off Parnell", 0.4, 25)}, title=...)

📊 Figure (described): Runs in each over for South Africa (blue, 169/5) and Sri Lanka (orange, 170/5), side by side for overs 1–20, with a red "X" above the bar for each wicket. The bars are strikingly similar through the middle overs. Two callouts mark the turning point: over 16 of the chase (2 runs, two wickets for Imran Tahir) and the 19-run over 17 off Wayne Parnell that followed. South Africa's tallest bar is their 21-run final over.
Reading a Manhattan
Read a Manhattan in three sweeps.
First, the skyline. Where are the towers and where are the valleys? South Africa's innings has one huge tower at the end — 21 runs in over 20, bowled by Isuru Udana — and a dip in over 14 (2 runs, Reeza Hendricks stumped). Sri Lanka's has a valley in overs 15–16 (2 and 2 runs) followed by the 19 and 15 of overs 17 and 19.
Second, the wickets. Clusters of X's tell you about collapses. Sri Lanka lost two wickets in over 16 and their valley sits exactly there: the over that took two wickets also cost only two runs. That is the classic double blow, and the Manhattan shows both halves of it at once.
Third, the phases. Mentally split the chart at overs 6 and 15. Our script adds up each phase from the same data:
Runs and wickets by phase
runs wkts
phase powerplay middle death powerplay middle death
innings
1 48 71 50 1 2 2
2 48 68 54 2 0 3
The powerplays were identical (48 each). South Africa's middle overs were three runs better; Sri Lanka's death overs were four runs better despite losing three wickets in them. On aggregate, the two innings were almost the same shape, which is why the match was close — and why the Manhattan alone cannot tell you who was winning at any moment. A Manhattan shows flow (runs in each over), not state (where the innings stands).
Format by format
- T20: the Manhattan's natural home. Twenty bars fit on a phone screen, and the phase structure (powerplay, middle, death) is visible at a glance.
- ODI: fifty bars per innings, a hundred for the match. It still works, but grouped side-by-side bars become thin; many broadcasters show one innings at a time, or aggregate into five-over blocks.
manhattan()widens the tick spacing automatically when there are more than 20 overs. - Test: do not draw a Manhattan of a Test innings. An innings of 125 overs gives 125 bars whose heights (mostly 0–6) carry little information; what matters in a Test is wickets per session and the lead, not runs per over. Case Study 2 builds the chart a Test needs.
- The Hundred: the format is ball-based (ten-ball sets from alternating ends), so "runs per over" is not the natural unit; aggregate by five-ball set or ten-ball block instead.
⚠️ Common pitfall: Reading a tall bar as "the batter attacked". A Manhattan bar is runs conceded in the over, including wides, no-balls, byes and leg-byes, and it doesn't say who scored them. A 15-run over might be three boundaries — or a bowler who sprayed four wides and a no-ball that went for four byes. Before you narrate a tall bar, check the over's deliveries.
7.3 The worm and the chase chart: who's ahead, and what's needed?
The cricket question: at this moment, which side is in front?
The worm answers a narrower version of that question: is the chasing side ahead of or behind the first innings at the same point? It plots cumulative runs against overs for both innings on one set of axes. Where the chasing team's line is above the other, they have scored more at that point than the first-innings side had.
📐 Definition — Worm: a line chart of cumulative runs (y) against overs bowled (x), one line per innings, drawn ball by ball, with a marker at each wicket. In this book the x-axis is legal balls ÷ 6, so wides and no-balls add runs without moving the line forward.
The worm in crease.charts uses the ball clock we built in match_balls():
def worm(balls, ax=None, innings=None, show_target=True, title=None, annotate=None, ...):
m = _prepared(balls)
for k, inn in enumerate(innings or sorted(m["innings"].unique())):
d = m[m["innings"] == inn]
x = np.concatenate([[0.0], d["balls_done"].to_numpy() / 6.0]) # start at 0/0
y = np.concatenate([[0], d["score"].to_numpy()])
ax.plot(x, y, color=TEAM_COLOURS[inn], lw=2, label=labels[inn])
w = d[d["is_dismissal"]]
ax.scatter(w["balls_done"] / 6.0, w["score"], s=36, color=TEAM_COLOURS[inn], ...)
...
np.concatenate([[0.0], ...]) prepends a starting point so every line begins at 0 runs, 0 overs. .to_numpy() turns a pandas column into a plain NumPy array, which is what matplotlib's plotting functions work with most cleanly.

📊 Figure (described): Cumulative runs against overs for South Africa (blue) and Sri Lanka (orange), with dots at each wicket and a dashed line at the target of 170. The two lines run almost on top of each other for 15 overs. Sri Lanka's line flattens through over 16 (116/2 to 118/4, two wickets in quick succession), dips below South Africa's, then rises steeply with the 19-run over 17 and finishes just above the target with a ball to spare.
The worm makes the match look like a tense dead heat for 16 overs — and in one sense it was. But you saw in the hook that the run-rate chart tells a different story. Here are the chase checkpoints the script prints:
After over 6: 48/2 over runs 3 need 122 off 84 RRR 8.71
After over 10: 81/2 over runs 8 need 89 off 60 RRR 8.90
After over 15: 116/2 over runs 2 need 54 off 30 RRR 10.80
After over 16: 118/4 over runs 2 need 52 off 24 RRR 13.00
After over 17: 137/4 over runs 19 need 33 off 18 RRR 11.00
After over 18: 144/5 over runs 7 need 26 off 12 RRR 13.00
After over 19: 159/5 over runs 15 need 11 off 6 RRR 11.00
After over 20: 170/5 over runs 11 need 0 off 0 RRR nan
📐 Definition — Current run rate (CRR) and required run rate (RRR): CRR = 6 × runs scored ÷ legal balls bowled. RRR = 6 × (target − runs scored) ÷ legal balls remaining. Both are in runs per over. At the start of a chase of 170 in 20 overs, RRR = 170 ÷ 20 = 8.50.
The run-rate chart
The chase chart puts three things on one axis, all in runs per over: the runs scored in each over (pale bars), the current run rate (solid line) and the required run rate (dashed line).
def run_rate_chart(balls, innings=2, ax=None, title=None, tick_step=1):
...
done = d["legal"].cumsum() # legal balls bowled by the end of each over
d["crr"] = 6 * d["cum_runs"] / done
ax.bar(d["over"], d["runs"], color=c, alpha=0.35, label="Runs in the over")
ax.plot(d["over"], d["crr"], color=c, lw=2, marker="o", label="Current run rate")
left = total_balls - done
need = target - d["cum_runs"]
d["rrr"] = np.where(left > 0, 6 * need / left.where(left > 0), np.nan)
ax.plot(d["over"], d["rrr"], color=INK, lw=2, ls="--", marker="s", label="Required run rate")
np.where(condition, a, b) picks a where the condition is true and b elsewhere — here it stops us dividing by zero balls remaining. left.where(left > 0) is the pandas version: it keeps values where the condition holds and turns the rest into missing values (NaN).

📊 Figure (described): For each over of Sri Lanka's chase, a pale orange bar shows the runs scored in that over; a solid orange line shows the current run rate and a dashed black line the required run rate. The two lines start together around 8.5–9, but the current rate drifts down to about 7.4 while the required rate climbs past 10 after over 14 and spikes to 13.00 after over 16. The tall bars of overs 17 and 19 pull the required rate back to 11.00 each time.
Read the gap between the two lines. Through the first ten overs it is small — Sri Lanka were scoring at roughly the rate they needed. From over 11 the gap widens steadily, and in overs 15 and 16 it opens into a chasm. The worm never showed that, because the worm compares Sri Lanka to South Africa's path, and South Africa's path was itself slow until a big finish.
Why does the same chase look level on one chart and losing on the other? Because "level with the other side after 15 overs" is only "on course" if the other side's last five overs were typical. South Africa's weren't: 50 runs in the death, including 21 off the last over. The worm quietly assumes that the first innings is a fair par path. When the first innings is back-loaded, the worm flatters the chase; when the first innings is front-loaded (a flying start, then a collapse), the worm makes the chase look worse than it is.
⚠️ Common pitfall: Treating the worm as a win-probability chart. "The lines crossed, so the chasing side was winning" is a mistake. The worm compares runs at equal overs; it ignores wickets in hand (Sri Lanka were 2 down when South Africa were 3 down at over 15, which matters) and the shape of the first innings. To ask "who is winning?" you need a model of the chase from runs needed, balls left and wickets in hand — which is exactly what Chapter 9 builds as a first lookup table and Chapter 20 builds properly. The win-probability curve is the chart the worm wishes it were.
Interactive worms
A printed worm cannot tell you which ball moved the line. An interactive one can. charts.interactive_worm() builds the same chart in plotly, with a hover label on every delivery — the over and ball, the score, the batter and bowler, and whether it was a four, a six or a wicket:
fig = charts.interactive_worm(m, title="Newlands, 25 Jan 2017 — hover any ball")
fig.write_html(IMG / "ch07-interactive-newlands-worm.html", include_plotlyjs="cdn")
The script writes images/ch07-interactive-newlands-worm.html; open it in any browser. include_plotlyjs="cdn" keeps the file small by loading the plotly library from the web rather than embedding it. Interactive charts are wonderful for exploring and for digital journalism; for a printed book or a slide, you still need the static version with the story annotated. Chapter 37 builds on both.
🔄 Check your understanding 1. In the Newlands Manhattan, Sri Lanka's over 16 bar is only 2 runs high. Why is it the most important bar in the chart? 2. After 15 overs, the worm shows Sri Lanka (116/2) three runs behind South Africa (119/3). The run-rate chart shows the required rate at 10.80 and the current rate at 7.73. Which chart better answers "is the chase on track?", and why? 3. Why does a Manhattan work for a T20 innings but not a Test innings?
Answer
- Because it combines a scoring drought (2 runs) with two wickets — the set batter Dickwella (68) and de Silva — at the moment the required rate was already above 10. The bar's shortness is the story, and the two X's above it explain the shortness.
- The run-rate chart. "On track" means "scoring fast enough to reach 170 in the balls left", which is exactly what the required rate measures. The worm compares Sri Lanka with South Africa's path, which was back-loaded (50 runs in the last five overs), so being level at 15 overs still left Sri Lanka well behind the rate they needed.
- A T20 innings has 20 overs whose run totals vary a lot and map onto the phases of the innings; the bars tell a story. A Test innings may last 120+ overs whose run totals are mostly small and similar; the story is in wickets, sessions and the lead, which a runs-per-over bar chart does not show.
7.4 Partnership bars: who built the innings, and with whom?
The cricket question: cricket is scored by individuals but built in pairs. Which partnerships carried each innings, and who did the scoring within them?
📐 Definition — Partnership: the runs (including extras) and legal balls from the fall of one wicket to the fall of the next — or to the end of the innings if the stand is unbroken. The first-wicket partnership is the opening stand. In
crease.charts, a stand also ends at a retirement, because a new batter comes in.
Building the partnership table
The partnership table is a nice example of a pandas trick worth learning: numbering the stands with shift() and cumsum().
def partnership_table(balls, innings):
m = _prepared(balls)
d = m[m["innings"] == innings].copy()
d["stand"] = d["is_wicket"].shift(fill_value=False).cumsum() + 1
rows = []
for k, s in d.groupby("stand"):
...
rows.append({"wicket": int(k), "batter_a": names[0], "batter_b": names[1],
"runs": int(s["runs_total"].sum()), "balls": int(s["is_legal"].sum()),
"runs_a": int(bat.get(names[0], 0)), "runs_b": int(bat.get(names[1], 0)),
"extras": int(s["runs_extras"].sum()), ...})
return pd.DataFrame(rows)
shift() moves a column down one row, so each delivery sees whether the previous delivery was a wicket. Adding those up with cumsum() gives a counter that ticks over on the first ball after every wicket: stand 1, stand 1, …, stand 2, stand 2, …. That one line replaces a loop with an if inside it, and it is exactly the kind of vectorised thinking Chapter 3 encouraged.
Running code/02_partnerships.py gives both innings at Newlands:
Partnerships — innings 1 (South Africa)
wicket batter_a batter_b runs balls runs_a runs_b extras start_over end_over ended_by
1 JT Smuts RR Hendricks 36 26 19 16 1 0.00 4.33 JT Smuts
2 AB de Villiers RR Hendricks 71 54 44 25 2 4.33 13.33 RR Hendricks
3 DA Miller AB de Villiers 10 8 1 8 1 13.33 14.67 DA Miller
4 AB de Villiers F Behardien 16 12 10 6 0 14.67 16.67 F Behardien
5 M Mosehle AB de Villiers 2 3 1 1 0 16.67 17.17 AB de Villiers
6 WD Parnell M Mosehle 34 17 3 31 0 17.17 20.00 unbroken
Partnerships — innings 2 (Sri Lanka)
wicket batter_a batter_b runs balls runs_a runs_b extras start_over end_over ended_by
1 N Dickwella WU Tharanga 36 25 13 20 3 0.00 4.17 WU Tharanga
2 LD Chandimal N Dickwella 9 6 5 4 0 4.17 5.17 LD Chandimal
3 DM de Silva N Dickwella 71 61 18 51 2 5.17 15.33 N Dickwella
4 DM de Silva S Prasanna 2 3 1 1 0 15.33 15.83 DM de Silva
5 BKG Mendis S Prasanna 24 10 2 21 1 15.83 17.50 BKG Mendis
6 DAS Gunaratne S Prasanna 28 14 11 15 2 17.50 19.83 unbroken
(start_over and end_over are overs elapsed, so 4.33 means four overs and two balls.)

📊 Figure (described): Horizontal bars, one per partnership with the opening stand at the top, for South Africa (left) and Sri Lanka (right). Each bar is split into the first-named batter's runs (blue), the second-named batter's runs (orange) and extras (grey), labelled "runs (balls)". Both innings are built on a 71-run third-wicket or second-wicket stand; Sri Lanka's last two stands with Prasanna (24 off 10 and 28 off 14) were much faster than anything earlier in the chase.
What the bars say
The two big stands were the same size — 71 runs each — but very different in shape. South Africa's AB de Villiers and Reeza Hendricks put on 71 off 54 balls, with de Villiers scoring 44. Sri Lanka's Dickwella and de Silva put on 71 off 61 balls, but de Silva's share was 18; Dickwella scored 51 of them.
That split matters for the chase. When one partner scores at well under a run a ball for 27 balls — de Silva finished 19 off 27, a strike rate of 70.37 — the other has to go at nearly two a ball to keep the required rate in check. The partnership bars show you that the stand which "rebuilt" Sri Lanka from 45 for 2 was also the stand that let the required rate climb, because its runs came disproportionately from one end.
Then look at the bottom of Sri Lanka's chart. Prasanna was in for the last three stands: 2 off 3 with de Silva, 24 off 10 with Kusal Mendis (Prasanna scoring 21 of them), 28 off 14 with Asela Gunaratne. Those two short bars at the bottom are the fastest scoring of the whole match, and they won it.
🧩 Productive struggle: Before reading on, look only at Sri Lanka's partnership bars and the fall-of-wickets table below. Which single partnership would you say cost Sri Lanka most — and how would you measure "cost" in a chase? Write down your measure before you read the next paragraph.
text innings over ball_in_over player_out wicket_kind bowler score wkts 2 5 1 WU Tharanga caught WD Parnell 36 1 2 6 1 LD Chandimal bowled Imran Tahir 45 2 2 16 2 N Dickwella caught Imran Tahir 116 3 2 16 5 DM de Silva stumped Imran Tahir 118 4 2 18 3 BKG Mendis run out D Paterson 142 5
There is no single right answer, which is the point. Measured by runs, the de Silva–Dickwella stand was the best of the innings. Measured by rate against requirement it is the worst: 71 runs off 61 balls is 6.98 an over, while Sri Lanka needed close to 9 an over through that period. Measured by what happened next — two wickets in three balls when it ended — it cost Sri Lanka their set batter at the worst moment. A partnership chart shows runs and balls; it does not know the target. To value a partnership properly you need to know how much it moved the side's chance of winning, which is the subject of Chapter 9 (value as change in win probability) and Chapter 12 (partnership networks). For now, the honest summary is that the bars show who and how fast, and you supply the context.
Format by format
Partnership bars transfer to every format better than any other chart in this section. In ODIs they show the rebuild-and-launch shape of a 50-over innings; in Tests they are often the most informative single chart of an innings, because Test innings are long sequences of partnerships, and a ninth- or tenth-wicket stand can swing a match (Case Study 2 has the most famous recent example). Only the "balls" label needs care in Tests: a 100-run stand off 300 balls is a slow T20 partnership and an excellent Test one.
🔄 Check your understanding 1. In
partnership_table, what doesd["is_wicket"].shift(fill_value=False).cumsum() + 1compute, and why is theshiftneeded? 2. South Africa's last partnership at Newlands was 34 off 17 balls, with Mangaliso Mosehle scoring 31. What does that stand explain on the Manhattan?
Answer
- A partnership number for every delivery.
shiftmoves the wicket flag down one row so that the ball on which a wicket falls still belongs to the stand that ended, and the next ball starts the new stand;cumsumthen counts the wickets so far, and+ 1makes the opening stand number 1.- The tall final bars of South Africa's innings — especially the 21-run 20th over. Most of the death-over acceleration came from one batter in one unbroken stand.
7.5 Heat maps: two dimensions at once
The cricket question: the IPL has changed. Where, exactly — which overs, which seasons?
A line chart shows one number changing along one dimension. Many cricket questions have two: run rate by over and by season; strike rate by batter and by phase; economy by bowler and by venue. A heat map puts one dimension on rows, the other on columns, and colours each cell by its value.
📐 Definition — Heat map: a grid of cells, one per combination of two categorical variables (here, season × over or batter × phase), each coloured by a numeric value. A sequential colour scale (light to dark, one direction) suits magnitudes; a diverging scale (two hues meeting at a neutral midpoint) suits values above and below a reference such as a league average.
Colour is the least accurate encoding on Cleveland's list, so the book's heat maps always print the number in each cell. The colour finds the pattern; the number gives the value.
The IPL scoring revolution, over by over
code/03_heatmaps.py computes the IPL's run rate for every over of the innings in every season — runs (including extras) per six legal balls, both innings, super overs excluded — and draws it with charts.heatmap():
balls["year"] = balls["start_date"].dt.year
g = balls.groupby(["year", "over"]).agg(runs=("runs_total", "sum"), legal=("is_legal", "sum"))
rr = (6 * g["runs"] / g["legal"]).unstack("over") # rows = year, columns = over 1..20
charts.heatmap(rr, ax=ax, fmt="{:.1f}", cbar_label="Runs per over", title=...)
.dt.year pulls the calendar year out of a date column (Cricsheet labels some IPL seasons "2007/08" or "2020/21"; the year of the matches is clearer). unstack("over") is the groupby cousin of pivot: it takes one level of a grouped index and spreads it across the columns.
IPL run rate (runs per over) by over of the innings — selected years
over 1 3 6 7 10 15 16 18 20
year
2008 6.06 7.12 8.46 7.20 7.58 8.96 8.72 10.00 11.13
2012 5.47 7.06 8.56 6.47 6.98 8.17 8.54 9.76 10.32
2018 6.42 9.10 8.94 7.03 8.36 8.43 8.75 10.57 12.11
2022 5.88 7.69 8.90 6.81 8.05 8.49 9.09 10.72 12.05
2023 6.10 9.07 9.29 7.28 8.35 9.53 9.29 10.16 11.69
2024 7.53 10.51 10.13 7.82 8.21 9.46 10.40 10.91 12.90
2025 7.52 10.14 10.46 8.17 9.08 9.48 10.03 11.15 12.51
2026 8.98 10.25 10.50 9.09 8.21 9.30 10.15 10.97 12.82
Highest cell: 2019 over 20 = 13.05; lowest cell: 2013 over 1 = 5.16

📊 Figure (described): A grid with seasons 2008–2026 as rows and overs 1–20 as columns, each cell coloured from dark purple (about 5 runs per over) to yellow (about 13) and labelled with its value; white vertical lines mark the ends of the powerplay and middle overs. The right-hand death columns are bright in every season. The striking change is in the bottom three or four rows, where the powerplay columns turn from blue-purple to green: the 2024–2026 seasons scored 10+ an over in overs 3–6, a rate earlier seasons reached only at the death.
Three patterns jump out that a table of 380 numbers would hide.
- The death overs barely changed. Over 20 ran at 11.13 in 2008 and 12.82 in 2026; it peaked at 13.05 in 2019. The final over was always a slog.
- The powerplay exploded. Over 3 went from 7.06 in 2012 to 10.51 in 2024. Over 1 — traditionally the quietest over in T20, when batters are getting their eye in against a new ball — went from a low of 5.16 in 2013 to 8.98 in 2026. The scoring revolution of the impact-player era (from 2023; see Chapter 1) is mostly a front-of-innings revolution.
- The post-powerplay dip is permanent. In every single row, over 7 is slower than over 6: 8.56 then 6.47 in 2012, 10.50 then 9.09 in 2026. When the fielding restrictions lift and five fielders can go back, scoring drops at once. The heat map shows that this is a rule of the format, not a quirk of a season.
The column averages tell the same story, more bluntly: a simple mean of the over cells gives powerplay 7.22, middle 7.40 for 2012, and powerplay 10.10, middle 9.31 for 2026.
Diverging scales: above and below the league
The second heat map asks a sharper question. For the fifteen highest run-scorers in IPL 2024–2026, how does each batter's strike rate in each phase compare with the league's strike rate in that phase over the same seasons? Subtracting the league figure gives a number centred on zero — the right job for a diverging colour scale.
league = batting_summary(recent.assign(all="league"), by=["all", "phase"]).reset_index()
league = league.set_index("phase")["strike_rate"]
ph = batting_summary(recent[recent["batter"].isin(top)], by=["batter", "phase"]).reset_index()
ph["rel"] = ph["strike_rate"] - ph["phase"].map(league)
ph.loc[ph["balls"] < 30, "rel"] = np.nan # too few balls: show as missing, not as zero
.assign(all="league") adds a constant column so batting_summary can treat the whole league as one "batter". .map(league) looks up each row's phase in the league Series — a dictionary-style lookup on a whole column at once. And the last line sets cells with fewer than 30 balls to NaN, which heatmap() draws as flat grey labelled "n/a".
League strike rate by phase, IPL 2024-2026: {'middle': 144.5, 'powerplay': 153.12, 'death': 171.61}
Top 15 run-scorers, IPL 2024-2026: phase SR minus league phase SR (balls in brackets)
runs balls strike_rate powerplay middle death
batter
V Kohli 2073 1340 154.70 11.4 (639) -7.7 (600) 27.4 (101)
B Sai Sudharsan 2008 1316 152.58 -11.1 (643) 11.1 (583) 37.3 (90)
Shubman Gill 1808 1155 156.54 -7.6 (554) 20.1 (514) 7.7 (87)
KL Rahul 1652 1082 152.68 -12.8 (494) 14.4 (491) 12.9 (97)
H Klaasen 1590 952 167.02 -35.8 (52) 12.8 (635) 28.4 (265)
Abhishek Sharma 1486 739 201.08 43.6 (494) 71.8 (221) nan (24)
SS Iyer 1453 879 165.30 -26.1 (137) 11.3 (536) 43.9 (206)
P Simran Singh 1443 885 163.05 6.5 (557) 21.5 (318) nan (10)
JC Buttler 1423 930 153.01 -11.6 (311) 5.4 (469) 15.1 (150)
YBK Jaiswal 1421 909 156.33 11.5 (579) -5.0 (306) nan (24)
TM Head 1351 767 176.14 28.4 (551) 18.0 (216) nan (0)
SA Yadav 1332 816 163.24 -7.9 (168) 18.8 (558) 25.1 (90)
SV Samson 1293 837 154.48 -5.3 (368) 6.3 (380) 26.1 (89)
Ishan Kishan 1276 777 164.22 5.9 (322) 16.6 (370) 26.0 (85)
R Parag 1275 816 156.25 -3.5 (125) 8.3 (562) 5.9 (129)

📊 Figure (described): Fifteen batters (rows, ordered by runs) by three phases (columns). Cells are blue where the batter's strike rate in that phase is below the league's and red where it is above, with white at zero and grey "n/a" where the batter faced fewer than 30 balls. Abhishek Sharma's powerplay (+44) and middle-overs (+72) cells are the darkest red; Heinrich Klaasen's powerplay cell is blue (−36) but rests on only 52 balls.
A diverging scale has three rules, and this chart follows all three. The midpoint means something (zero = league average for that phase). The scale is symmetric — heatmap() sets the limits to ±the largest absolute value, so +40 and −40 are equally intense. Missing is not average — a grey "n/a" is visibly different from the near-white of "about the same as the league". Break that last rule and Travis Head's empty death-overs cell (zero balls) would look like a batter who scores exactly at league rate at the death.
Two readings. First, look at Abhishek Sharma's row: +44 in the powerplay on 494 balls and +72 in the middle overs on 221. That is the most extreme profile in the chart, and it rests on enough balls to take seriously. Second, look at Klaasen's −36 powerplay cell. It is vivid blue — and it rests on 52 balls. Your eye goes to the most saturated cells, and the most saturated cells are often the smallest samples. That is the heat-map form of the small-sample problem from Chapter 6.
⚠️ Common pitfall: Letting colour intensity stand in for evidence. A heat map gives a 52-ball cell the same size and the same colour weight as a 635-ball cell. Always either suppress small cells (as here, below 30 balls), print the sample size in the cell or the axis label, or shrink the cell value toward the league average with the methods of Chapter 6 before you colour it.
📋 Try it — Evaluate this player: Using the table above, describe Shreyas Iyer's (SS Iyer) 2024–26 IPL batting profile in two sentences, phase by phase, and say which cell you trust least and why.
Worked answer
Iyer is slower than the league in the powerplay (26 below the league's 153.12, on 137 balls), slightly above it in the middle overs (+11 on 536 balls) and far above it at the death (+44 on 206 balls) — a middle-order batter who accelerates hard late, not an opener. The powerplay cell is the least trustworthy: 137 balls is a modest sample, and the balls he faced in the powerplay probably came after early wickets (a different situation from an opener's powerplay), so the comparison with the league's powerplay rate is not like for like.
7.6 Small multiples: many matches, one glance
The cricket question: what did the knockout matches of 2026 look like — were they close, one-sided, chases or defences?
You could draw ten worms in ten separate figures. The reader would then have to remember the first while looking at the tenth, and the axes would differ from chart to chart, so a 250-run innings and a 150-run innings would look the same height. Tufte's answer is small multiples: the same small chart repeated in a grid, with shared axes, so the eye can compare panels directly.
📐 Definition — Small multiples: a set of small charts of the same type, one per subgroup (match, player, season), laid out in a grid with identical scales so that differences between panels are differences in the data, not in the axes.
charts.small_multiples() is a thin helper around matplotlib's subplots(..., sharex=True, sharey=True) that hides unused panels. The script draws the worms of the ten knockout matches of 2026 in the data — the men's T20 World Cup semi-finals and final, the four IPL playoff matches, and the women's T20 World Cup semi-finals and final:
fig, axes = charts.small_multiples(len(KNOCKOUTS), ncols=5, panel=(2.15, 2.3))
for ax, (code, mid, label) in zip(axes, KNOCKOUTS):
m = charts.match_balls(load_deliveries(code), mid)
charts.worm(m, ax=ax, show_target=False, title="")
...
axes[0].set_ylim(0, top * 1.05) # shared y: one limit for every panel
That last line matters more than it looks. With sharey=True, every panel uses the same y-limits, which are set by the first panel drawn — so we must set them to fit the largest total across all ten matches, or the 250-run innings would be cut off at the top.
Knockout matches of 2026 (small multiples)
match date innings_1 innings_2 winner margin
Men's WC SF 1 2026-03-04 South Africa 169/8 (20 ov) New Zealand 173/1 (12.5 ov) New Zealand 9 wkts
Men's WC SF 2 2026-03-05 India 253/7 (20 ov) England 246/7 (20 ov) India 7 runs
Men's WC Final 2026-03-08 India 255/5 (20 ov) New Zealand 159/10 (19 ov) India 96 runs
IPL Qualifier 1 2026-05-26 Royal Challengers Bengaluru 254/5 (20 ov) Gujarat Titans 162/10 (19.3 ov) Royal Challengers Bengaluru 92 runs
IPL Eliminator 2026-05-27 Rajasthan Royals 243/8 (20 ov) Sunrisers Hyderabad 196/10 (19.2 ov) Rajasthan Royals 47 runs
IPL Qualifier 2 2026-05-29 Rajasthan Royals 214/6 (20 ov) Gujarat Titans 219/3 (18.4 ov) Gujarat Titans 7 wkts
IPL Final 2026-05-31 Gujarat Titans 155/8 (20 ov) Royal Challengers Bengaluru 161/5 (18 ov) Royal Challengers Bengaluru 5 wkts
Women's WC SF 1 2026-06-30 West Indies 125/7 (20 ov) Australia 127/2 (13 ov) Australia 8 wkts
Women's WC SF 2 2026-07-02 England 169/5 (20 ov) South Africa 129/8 (20 ov) England 40 runs
Women's WC Final 2026-07-05 England 150/4 (20 ov) Australia 153/3 (17.1 ov) Australia 7 wkts

📊 Figure (described): Ten small worm charts in two rows of five, every panel with the same x-axis (0–20 overs) and y-axis (0 to about 270 runs); blue lines are the side batting first, orange the side batting second. Only one panel — the men's World Cup second semi-final, India 253 v England 246 — shows two lines tracking each other to the end. Several chases (New Zealand in the first semi-final, Australia in the women's first semi-final) end far to the left of the 20-over mark, and the men's World Cup final and IPL Qualifier 1 show the blue line pulling far above the orange.
The grid tells you things no single worm can. Only one of the ten knockouts was close all the way: India v England in the men's semi-final at the Wankhede, 253 against 246. Three were crushed by 90-plus runs or nine wickets. The orange lines that stop early — New Zealand reaching 173 in 12.5 overs, Australia's women 127 in 13 — are chases that were never in doubt; you see their shortness at once because every panel shares the same x-axis. And the height of the men's panels against the women's is a real difference in scoring between the competitions, not an artefact of scaling — which is precisely what shared axes guarantee.
🔍 Why this works: Small multiples work because they turn a memory task into a perception task. Comparing chart 1 with chart 10 on separate pages requires you to remember chart 1; comparing them side by side on identical axes requires only that you look. The shared scale is the whole trick: the moment one panel gets its own y-axis, "taller" stops meaning "more runs", and the reader is back to reading tick labels. That is also why the book's helper sets the shared limit from the largest total rather than letting matplotlib pick from the first panel.
🔄 Check your understanding 1. Why must the small-multiples grid set its shared y-limit from the largest innings total across all panels? 2. In the ten knockout worms, how can you tell at a glance which chases were never in doubt?
Answer
- Because with shared axes, the limits are set once for every panel; if they came from the first panel drawn (a 169-run innings), the 250-run innings in other panels would be cut off at the top and the comparison would be wrong.
- Their orange lines stop well short of 20 overs — New Zealand reached 173 in 12.5 overs and Australia's women 127 in 13 — because every panel shares the same x-axis, a short line means a quick, comfortable chase.
7.7 Control charts: is this season really different?
The cricket question: first-innings totals in the IPL have gone up. Is that a real change in the game, or the kind of drift that always happens from season to season?
That question has a sixty-year-old answer from manufacturing. A control chart plots a series in time order with a centre line and two natural process limits, computed from the series' own variation. Points inside the limits are consistent with "the same process, ordinary noise". Points outside are signals: evidence that something in the process changed.
📐 Definition — Individuals (XmR) control chart: for a series of single values x₁, x₂, …, compute the centre line x̄ (the mean of a baseline period) and the average moving range MR̄ = mean of |xᵢ − xᵢ₋₁| over the baseline. The natural process limits are x̄ ± 2.66 × MR̄. A point outside the limits is a signal of a change in the process, not proof of what caused it.
crease.charts gives you both the limits and the chart:
def xmr_limits(values, baseline=None):
base = values.loc[baseline] if baseline is not None else values
mr = base.diff().abs().dropna() # moving ranges |x_i - x_(i-1)|
centre, mrbar = float(base.mean()), float(mr.mean())
return {"centre": centre, "mr_bar": mrbar, "ucl": centre + 2.66 * mrbar, "lcl": centre - 2.66 * mrbar}
.diff() subtracts each value from the one before it; .abs() makes the differences positive; .dropna() drops the first (which has no predecessor).
The script computes the IPL's average first-innings total by season — matches decided without DLS, super overs excluded — and sets the baseline to 2008–2022, the seasons before the Impact Player rule:
IPL average first-innings total by season (results without DLS)
cricsheet_label matches avg_first_innings
year
2008 2007/08 56 161.9
2009 2009 53 150.3
2010 2009/10 59 165.3
2011 2011 69 155.6
2012 2012 74 157.5
2013 2013 74 156.3
2014 2014 58 163.6
2015 2015 54 165.2
2016 2016 56 164.3
2017 2017 57 166.7
2018 2018 57 172.1
2019 2019 57 168.3
2020 2020/21 56 169.2
2021 2021 59 159.3
2022 2022 74 171.1
2023 2023 71 183.0
2024 2024 71 189.6
2025 2025 69 190.9
2026 2026 71 195.7
Baseline 2008-2022: mean 163.1, average moving range 5.96, natural limits 147.3 to 179.0
Seasons outside the limits: {2023: 183.0, 2024: 189.6, 2025: 190.9, 2026: 195.7}

📊 Figure (described): IPL average first-innings totals for 2008–2026 joined by a line, with a solid centre line at 163.1 and dashed limits at 147.3 and 179.0 computed from the shaded baseline period 2008–2022. Every baseline season sits inside the limits, including the high of 172.1 in 2018. All four seasons from 2023 to 2026 sit above the upper limit, marked as red squares and labelled 183.0, 189.6, 190.9 and 195.7.
For fifteen seasons the IPL's first-innings average wandered between 150.3 and 172.1 — ups and downs that commentators explained with pitches, balls, auction cycles and dew, but which all fit comfortably inside the limits of a single stable process. Then, from 2023, four consecutive seasons sit outside the upper limit, and each is higher than the one before. On a control chart that is about as clear a signal as you will ever see.
What the chart does not tell you is why. The Impact Player rule arrived in 2023 and is strongly linked to the scoring surge — a substitute who can bat lets sides bat deeper, and batting deeper encourages risk at the top of the order. But the powerplay heat map in Section 7.5 shows scoring rising fastest at the very start of the innings, so batting intent and approach have changed too. The chart detects the change; explaining it takes other evidence.
🔍 Why this works: Why 2.66, and why moving ranges instead of the standard deviation? For data that behave like independent draws from a normal distribution, the average moving range divided by 1.128 estimates the standard deviation, and 3 ÷ 1.128 ≈ 2.66 — so the limits sit about three standard deviations from the centre. Using moving ranges rather than the overall standard deviation is the clever part: if the series has drifted or jumped, the overall standard deviation is inflated by the very change you are trying to detect, while consecutive differences stay small. That is why we compute the limits from the baseline only and let the new seasons fall where they may. The method is Walter Shewhart's, from industrial quality control, and has been popularised for managers by Donald Wheeler; nothing about it is specific to factories.
⚠️ Common pitfall: Calling every high season a "trend". In the baseline period alone, the average first-innings total rose from 159.3 in 2021 to 171.1 in 2022 — a jump of almost 12 runs — and fell from 172.1 in 2018 to 168.3 in 2019. Both moves are inside the limits. A pundit who announced "the game has changed" in 2018 would have been reacting to noise; the control chart says you need a point outside the limits (or a long run on one side of the centre line) before you claim a change.
Where else control charts help
Any series in time order where you want to separate signal from noise: a bowler's economy by match across a season (has he lost something, or is this the usual spread?), a team's powerplay run rate across a tournament, the share of dismissals that are lbw across Test years after a change to playing conditions. Two cautions carry over from Chapter 6: the limits assume the points are roughly independent and comparable (season averages based on 50–70 matches each are; single T20 innings mostly are not, because they vary so wildly), and with many charts, some points will fall outside the limits by chance.
🔄 Check your understanding 1. In the heat map of IPL run rate by over, why does every row show over 7 slower than over 6? 2. Why does
heatmap()draw a missing cell in flat grey rather than leaving it at the colour for zero? 3. The control chart's limits were computed from 2008–2022. What would happen to the limits if you computed them from 2008–2026 instead, and why would that make the chart worse at its job?
Answer
- The powerplay ends after over 6. From over 7, five fielders may stand outside the 30-yard circle instead of two, so boundaries become harder to find and scoring drops immediately.
- On a diverging scale, zero means "exactly league average" and is drawn near-white. A missing cell coloured near-white would claim the batter scores at league rate in that phase, when in fact we have too few (or no) balls to say anything. Grey with "n/a" says "no evidence".
- Including 2023–2026 would raise the centre line and, because the jump from 171.1 to 183.0 adds a large moving range, widen the limits. The new seasons would then look closer to "ordinary variation" — the chart would partly absorb the very change it is meant to detect. Limits should describe the process before the suspected change.
7.8 Spider charts: the profile, and its problems
The cricket question: how do four of the best openers in women's T20 internationals compare across several batting skills at once?
The spider or radar chart is the scouting report's favourite graphic. Each skill is a spoke from the centre; a player's value on each skill is a point on its spoke; joining the points gives a polygon whose shape is meant to be the player's "profile". It is popular in football and increasingly in cricket. It is also one of the easiest charts to misread, and you should know both why it is popular and why it misleads.
Putting skills on a common scale
Average (runs per dismissal), strike rate and dot-ball percentage are in different units, so before they can share a radar they must share a scale. The usual choice is the percentile rank within a comparison pool.
📐 Definition — Percentile rank (within a pool): the percentage of players in the pool whose value is at or below this player's value. A percentile of 90 on strike rate means the player's strike rate is at least as high as 90% of the pool's. For metrics where lower is better (dot-ball %), the ranking is inverted, so a high percentile always means "better".
charts.percentile_frame() does this in one line using pandas' rank(pct=True), which returns each value's rank as a fraction of the group:
def percentile_frame(df, cols, invert=()):
out = pd.DataFrame(index=df.index)
for c in cols:
out[c] = (100 * df[c].rank(pct=True, ascending=c not in invert)).round(1)
return out
code/05_radar.py defines the pool as every women's T20I batter with at least 1,000 balls faced in the data — 103 batters — and computes six metrics: average, strike rate, boundary-ball percentage, dot-ball percentage, powerplay strike rate and middle-overs strike rate. Four openers are compared: Smriti Mandhana (India), Beth Mooney (Australia), Laura Wolvaardt (South Africa) and Chamari Athapaththu (Sri Lanka; Cricsheet records her as "AC Jayangani").
Raw numbers
runs balls average strike_rate boundary_ball_pct dot_pct pp_sr mid_sr
batter
Smriti Mandhana 4612 3552 32.48 129.84 20.52 42.06 122.66 136.12
Beth Mooney 3816 2993 41.93 127.50 17.31 34.51 110.25 137.26
Laura Wolvaardt 2984 2413 39.26 123.66 16.37 36.47 118.51 115.83
Chamari Athapaththu 3837 3198 29.98 119.98 19.42 49.66 111.97 125.00
Percentile ranks within the pool (dot % inverted: higher = fewer dots)
average strike_rate boundary_ball_pct dot_pct pp_sr mid_sr
batter
Smriti Mandhana 87.4 95.1 98.1 69.9 97.1 95.1
Beth Mooney 99.0 94.2 91.3 96.1 87.4 97.1
Laura Wolvaardt 97.1 92.2 85.4 89.3 94.2 77.7
Chamari Athapaththu 73.8 85.4 96.1 26.2 89.3 92.2
Pool medians: {'average': 23.87, 'strike_rate': 99.22, 'boundary_ball_pct': 11.32, 'dot_pct': 46.03, 'pp_sr': 84.33, 'mid_sr': 97.05}

📊 Figure (described): A six-spoked radar with axes for average, strike rate, boundary %, dot avoidance, powerplay strike rate and middle-overs strike rate, each scaled 0–100 by percentile among 103 women's T20I batters. Four overlapping polygons, each with its own colour, line style and marker: Mandhana (solid blue), Mooney (dashed orange), Wolvaardt (dotted green) and Athapaththu (dash-dot purple). All four polygons are large and push toward the outer ring; Athapaththu's has a deep notch on "dot avoidance" (26th percentile) and Mooney's is the most uniformly large.
The radar does show some things well. Athapaththu's notch on dot avoidance is the first thing you see: she plays more dot balls (49.66%) than most of the pool, and makes up for it with boundaries (96th percentile). Mooney's polygon is the most even — 87th percentile or better on everything. Wolvaardt's has a flat side on middle-overs strike rate (77.7th percentile, 115.83).
Three problems with radars
1. Overlap. Four filled polygons on one radar is already hard to read; the book's radar() function refuses more than four and tells you to use small multiples instead. Even with four, the polygons cover each other in exactly the region (the outer ring) where these elite players live.
2. Percentiles compress the elite. Every one of these players is above the 70th percentile on almost every axis, so the radar squeezes the differences that matter — Mooney's average of 41.93 against Athapaththu's 29.98 is a big gap in cricket terms, but on the radar it is 99.0 against 73.8, near the rim. Percentiles also depend entirely on the pool: our pool includes associate-nation batters who face elite attacks less often, so "95th percentile" here is not "95th percentile among Test-nation openers". Compared with whom? is always the first question.
3. The area depends on the order of the axes. Your eye reads the polygon's area as the player's overall quality. But the area of a radar polygon depends on which axes sit next to each other: a low value between two high values cuts a deep notch; the same low value next to another low value removes less. The script computes the polygon area for every one of the 720 possible orderings of the six axes:
Radar polygon area (percentile units^2): min and max over all 720 orderings of the six axes
Smriti Mandhana percentiles [87, 95, 98, 70, 97, 95] area 21135 to 21286 (max is 1% larger)
Beth Mooney percentiles [99, 94, 91, 96, 87, 97] area 23015 to 23062 (max is 0% larger)
Laura Wolvaardt percentiles [97, 92, 85, 89, 94, 78] area 20644 to 20767 (max is 1% larger)
Chamari Athapaththu percentiles [74, 85, 96, 26, 89, 92] area 14773 to 15622 (max is 6% larger)
DB Sharma percentiles [46, 65, 40, 100, 9, 47] area 5352 to 7241 (max is 35% larger)
(the last row is the pool's most uneven profile: DB Sharma)
For uniformly strong players like Mooney the order hardly matters. For uneven profiles it matters a lot. The most uneven profile in the pool belongs to India's Deepti Sharma — 100th percentile on dot avoidance (she plays fewer dot balls than anyone in the pool) but 9th percentile on powerplay strike rate. Merely rearranging the spokes can make her polygon 35% bigger. Nothing about her batting changed; only the chart did.
The honest alternative
When the question is "how do these players compare with each other and with the pool?", a set of aligned strips in raw units answers it better. Each metric gets its own horizontal strip; the 103 batters in the pool are grey dots; the four openers are coloured markers; a dashed line marks the pool median.

📊 Figure (described): Six horizontal strips — average, strike rate, boundary %, dot %, powerplay SR and middle-overs SR — each showing all 103 pool batters as grey dots in raw units, with a dashed line at the pool median and the four openers as coloured markers of different shapes. On average, Mooney (41.93) and Wolvaardt (39.26) stand clear at the right while Athapaththu (29.98) sits among the pack; on dot %, Mooney (34.51) and Wolvaardt (36.47) are near the far left (fewest dots) while Athapaththu (49.66) is right of the median.
The strips use position on a common scale — the most accurate encoding on Cleveland's list — and keep the units, so a reader can see that Mooney's average is twelve runs higher than Athapaththu's, not just "higher percentile". They also show the whole pool, so you can see where the elite end begins. The radar's one advantage is compactness: a single small radar per player, in a grid of small multiples, is a reasonable scouting thumbnail. Use it as a thumbnail, not as evidence.
🔷 R corner: the same strips in R with ggplot2 (not run in this book's build):
r library(dplyr); library(tidyr); library(ggplot2) long <- pool |> pivot_longer(c(average, strike_rate, boundary_ball_pct, dot_pct), names_to = "metric", values_to = "value") ggplot(long, aes(value, metric)) + geom_jitter(height = 0.15, colour = "grey70", size = 1) + geom_point(data = filter(long, batter %in% openers), aes(colour = batter), size = 3) + facet_wrap(~ metric, scales = "free_x", ncol = 1) + theme_minimal()🔄 Check your understanding 1. What does a percentile rank of 26.2 on "dot avoidance" mean for Chamari Athapaththu, in words? 2. Deepti Sharma's radar polygon can change area by 35% depending on axis order; Beth Mooney's barely changes. Why the difference?
Answer
- About 74% of the 103 batters in the pool play a lower share of dot balls than she does (her dot % is 49.66 against a pool median of 46.03); only about a quarter play more dots.
- Area depends on the products of neighbouring spokes. When all six values are similar (Mooney: 87–99), every ordering gives almost the same products. When values are very uneven (Deepti: 9 to 100), putting the high values next to each other inflates the area and separating them shrinks it.
7.9 Wagon wheels, pitch maps and beehives: the charts we cannot draw from public data
The cricket question: where does a batter score, and where does a bowler land the ball?
These are the most famous charts in televised cricket, and they are the ones this book has to treat most carefully. A wagon wheel needs the direction and distance of every scoring shot. A pitch map needs where every delivery bounced. A beehive needs where every delivery passed the batter's stumps. None of that is in Cricsheet. Ball-tracking comes from Hawk-Eye (owned by Sony) and similar systems; shot directions are hand-coded by broadcasters' and data companies' scorers. The feeds are commercial and are not public.
So we do what honest analysts do when the data does not exist: we build the method on a clearly labelled stand-in, and we are explicit about what the stand-in can and cannot tell us.
🧪 Simulated data: every chart in this section uses the toolkit's simulated tracking layer,
tracking_sim.add_tracking(). It takes real deliveries and attaches simulated columns whose names start withsim_: pitch length and line, height at the stumps, speed, shot zone, shot angle and distance. The outcomes — runs, boundaries, wickets — are real. The locations are drawn at random from distributions conditioned on the real outcome (a real six is more likely to have come from a full or short ball; a real bowled is more likely to have been full and straight), on format and phase, and on the bowler's real type (pace or spin) from the reference tabledata/reference/player_styles.csvwhere the bowler is listed. Each player also gets a stable simulated "signature" derived from their name — so a bowler's pitch map looks consistent from match to match, but it is not that bowler's real signature. Nosim_number in this book is a fact about a real player.
Wagon wheels
newlands = add_tracking(t20i[t20i["match_id"] == "936157"]) # same input -> same output
s = newlands[(newlands["batter"] == "N Dickwella") & (newlands["wides"] == 0)]
charts.wagon_wheel(s, ax=ax, hand="L", title="N Dickwella — 68 off 51 (left-hander)")
wagon_wheel() draws the ground from above, with the batter at the centre and straight down the ground up the page. Singles to threes are thin grey spokes, fours blue, sixes orange (drawn just past the rope, since the exact landing point of a six adds nothing). The hand argument puts the OFF SIDE label on the correct side: the real batting hand comes from the styles table, and the simulation mirrors shot angles for left-handers.
Newlands T20I with simulated tracking: 244 deliveries, 92.6% with a real bowler type from the styles table
N Dickwella: REAL 68 off 51 balls, 10 fours, 1 sixes; batting hand (styles table): Left
SIMULATED runs by shot zone: {'square_leg': 19, 'fine_leg': 15, 'long_on': 10, 'cover': 8, 'third_man': 8, 'midwicket': 5, 'long_off': 2, 'point': 1}
S Prasanna: REAL 37 off 16 balls, 3 fours, 3 sixes; batting hand (styles table): Right
SIMULATED runs by shot zone: {'fine_leg': 17, 'midwicket': 6, 'cover': 4, 'long_off': 4, 'square_leg': 4, 'third_man': 2}

📊 Figure (described): Two wagon wheels, titled "simulated tracking layer — real outcomes, simulated locations". Left: Niroshan Dickwella's 68 off 51 (left-hander, off side on the left), with 18 grey spokes for 1–3 runs, 10 blue spokes for fours and one orange spoke for a six. Right: Seekkuge Prasanna's 37 off 16 (right-hander, off side on the right), with 5 grey, 3 blue and 3 orange spokes. The number of each kind of spoke is real; their directions are simulated.
Read that figure carefully, because it contains both kinds of information at once. The counts in the legend — 10 fours and one six for Dickwella, three of each for Prasanna — are real, straight from the ball-by-ball record. The directions are invented by the simulation. If you wrote "Dickwella scored 19 runs through square leg", you would be stating a simulated number as a fact, which this book never does.
Pitch maps and beehives
The pitch map plots each delivery where it bounced: distance from the batter's stumps (bands for yorker, full, good, short, bouncer) against line (centimetres either side of middle stump). The book draws it from the bowler's end with the batter's stumps at the top, so a right-hander's off side is on the left of the picture. The beehive plots where each ball passed the stumps, with the stumps drawn to scale (22.86 cm wide, 71.1 cm tall). Both colour each delivery by its real outcome: grey dot, blue runs, orange boundary, red "X" for a wicket credited to the bowler.
ipl = add_tracking(load_deliveries("ipl"))
bum = ipl[(ipl["bowler"] == "JJ Bumrah") & (ipl["phase"] == "death") & ~ipl["super_over"]]
rash = ipl[(ipl["bowler"] == "Rashid Khan") & (ipl["phase"] == "middle") & ~ipl["super_over"]]
charts.pitch_map(bum, ax=axes[0], bowler_type="pace", title=...)
charts.pitch_map(rash, ax=axes[1], bowler_type="spin", title=...)
charts.beehive(bum, ax=ax, title="Beehive — Jasprit Bumrah, IPL death overs")
The real numbers behind these deliveries come from bowling_summary, and they are worth having:
JJ Bumrah, IPL death overs: REAL 1423 legal balls, 1943 runs, 102 wickets, economy 8.19, dot % 34.0
Rashid Khan, IPL middle overs: REAL 2552 legal balls, 2921 runs, 121 wickets, economy 6.87, dot % 37.0
An economy of 8.19 in the death overs across Bumrah's IPL career is real; so are the 102 wickets. Where those balls pitched is not in the data.

📊 Figure (described): Two pitch maps titled "simulated tracking layer — real outcomes, simulated locations", each viewed from the bowler's end with the stumps at the top and shaded length bands. Left: 1,423 legal death-over balls by Jasprit Bumrah (pace bands from yorker to bouncer) — dots spread across all lengths, with wickets (red X) scattered through every band. Right: 2,552 middle-over balls by Rashid Khan (spin bands), concentrated in the full and good-length bands, with very few short balls. The legends give real outcome counts: for Bumrah 382 dots, 724 runs, 215 boundaries, 102 wickets.

📊 Figure (described): A beehive viewed from the bowler's end, with the stumps drawn to scale at the bottom centre and each of Bumrah's 1,423 legal IPL death-over balls plotted at the height and line where it (in the simulation) passed the stumps, coloured by real outcome. A caption reads "simulated tracking layer — real outcomes, simulated locations". Many wicket X's sit in front of the stumps at low height and a second group sits at chest-to-head height.
What the simulated chart is really showing you
The script prints the simulated length mix within each real outcome:
JJ Bumrah, IPL death overs
SIMULATED length share within each REAL outcome (% of column):
outcome boundary dot runs wicket
sim_length
yorker 5.6 27.5 20.9 20.6
full 37.2 19.1 22.2 24.5
good 11.2 23.3 20.7 22.5
short 34.9 19.4 25.7 20.6
bouncer 11.2 10.7 10.5 11.8
That table looks like an insight — "only 5.6% of the boundaries Bumrah conceded at the death came from yorkers, against 27.5% of his dot balls" — and it is exactly the kind of sentence you must not write. It is not a finding about Bumrah. It is the simulation's own rules coming back out: the toolkit was told that real dot balls at the death are more likely to have been yorkers and real boundaries less likely, so it generated data that says so. A chart drawn from simulated data can only ever show you the assumptions that built it. That is the deep lesson of this section, and it applies to every model you will ever build: if the pattern was put in, finding it again is not evidence.
What the simulation is good for is everything except the conclusion. You can write the pitch-map function, test it, check that it handles left-handers, spinners, wides and no-balls, design the colour scheme, and learn to read the chart — all on data that has the right shape. Then, if you ever have access to real tracking data (a franchise feed, a broadcaster's archive, a research partnership), the same code draws the real thing. Chapter 15 goes much deeper into length-and-line analysis on the simulated layer, with the same rules.
What would a franchise with the real Hawk-Eye feed see differently? Real pitch maps are not tidy bands: lengths cluster tightly for accurate bowlers and spray for erratic ones, lines differ to left- and right-handers, and the clusters shift by venue, by ball age and by plan. The real beehive would show you a bowler's intent: whether that "short" ball was aimed at the ribs or the helmet, whether the yorkers were on the toes or wide outside off. And real wagon wheels reveal field-placement opportunities — a batter who never scores behind square on the off side earns a different field. None of that can come from Cricsheet, and the book will not pretend otherwise.
🏏 Eye test: Wendell Baptiste watches the Bumrah beehive for a long time and then laughs. "You know what's missing? The batter. A beehive tells you where the ball went. It doesn't tell you where the batter's feet were. Half the yorkers I bowled that went for four weren't bad balls — the batter had stepped away to leg and turned my yorker into a half-volley outside off. And a bouncer at the death that goes for six is a different ball to a bouncer that's called a wide. When I coach the Pelicans' bowlers, I watch the video and the batter's set-up. The chart is a summary of a hundred decisions — mine and his." He is right. Even real ball-tracking records the ball, not the batter's movement or the field the bowler was bowling to, which is why the best analysts pair tracking charts with video.
7.10 Designing for the reader: colour, annotation and the phone screen
The cricket question: your chart is correct. Will anyone read it correctly?
Kavya's thumb test from the hook is the practical version of everything in this section. Most of the people who will see a cricket chart see it on a phone, for a few seconds, in a feed full of other things. Some of them see colour differently from you. The chart has to survive that.
Before and after
The script code/07_design_principles.py draws the same real numbers — each IPL team's 2026 run rate in each phase — two ways.
IPL 2026 run rate (runs per over, incl. extras) by batting team and phase
phase powerplay middle death overall
batting_team
Lucknow Super Giants 10.30 7.97 10.33 9.23
Kolkata Knight Riders 8.82 8.96 10.62 9.25
Chennai Super Kings 10.00 8.58 10.45 9.44
Delhi Capitals 8.67 9.17 11.41 9.51
Gujarat Titans 9.65 9.24 10.00 9.53
Mumbai Indians 9.27 9.35 10.26 9.54
Rajasthan Royals 11.67 9.59 10.34 10.42
Royal Challengers Bengaluru 10.42 10.04 11.57 10.48
Sunrisers Hyderabad 11.08 10.12 10.67 10.54
Punjab Kings 10.95 9.97 12.55 10.84

📊 Figure (described): Left, "before": thirty thin bars in three phase groups, one rainbow colour per team in alphabetical order, a y-axis that starts at 7.5 rather than zero, heavy gridlines and a ten-entry legend in tiny type; Punjab Kings' death bar runs off the top. Right, "after": one row per team sorted by overall run rate, with a grey bar spanning each team's slowest to fastest phase, three marker shapes for the phases on a common runs-per-over axis and a tick for the whole innings. Punjab Kings sit at the top (overall 10.84, death 12.55) and Lucknow Super Giants at the bottom (overall 9.23, middle 7.97).
The "before" chart breaks four rules at once. Rainbow colour for categories: ten teams in ten hues, which nobody can match to a legend in a few seconds (and some of which collapse for colour-blind readers). Alphabetical order: the order of the data is the order of the names, which carries no information. A truncated bar axis: bars encode value by length, so a bar axis must start at zero; starting at 7.5 makes 8.0 look a quarter the size of 9.5. A far-away legend: the eye has to jump back and forth thirty times.
The "after" chart is a Cleveland dot plot. Each team is one row, sorted by the quantity that matters, so the ranking is readable at once. The three phases are marks on a common position scale — the most accurate encoding — and because dots encode by position, not length, the axis does not need to start at zero. The grey range bar shows each team's spread between phases: Delhi Capitals had the widest gap, from 8.67 in the powerplay to 11.41 at the death; Gujarat Titans the narrowest, 9.24 to 10.00.
Colour-vision deficiency, measured
Roughly one man in twelve of northern European descent has some form of red–green colour-vision deficiency (the commonly cited figure; it is lower in women and varies by population). In a stadium of 30,000 that is a lot of people who cannot see your red-and-green Manhattan as you intended. You do not have to guess how bad a palette is: the colour difference between two colours can be computed. The script simulates protanopia and deuteranopia (the two most common severe forms) with a published simulation model and computes the CIE76 colour difference, ΔE, between pairs of colours:
Colour difference, CIE76 delta E (bigger = easier to tell apart; under ~10 is hard)
pair normal protanopia deuteranopia
red v green (tab10) 119.8 37.6 7.3
orange v green (tab10) 100.6 4.6 32.3
blue v orange (tab10) 122.0 101.0 118.1
blue v purple (tab10) 38.2 5.7 8.0
Okabe-Ito blue v orange 120.2 109.5 121.7
Okabe-Ito green v purple 87.5 36.2 17.9
(The "under ~10" threshold is a rough working rule for chart colours, not a standard.) Matplotlib's default red and green are 119.8 apart for typical vision and 7.3 apart under deuteranopia. Its default orange and green — a pairing you would never suspect — collapse to 4.6 under protanopia. Blue and orange stay far apart under every simulation, which is why the book uses them for the two innings. For comparisons of up to four players, crease.charts uses a separate four-colour set from Masataka Okabe and Kei Ito's colour-blind-friendly palette and varies line style and marker shape, so identity never depends on colour alone.

📊 Figure (described): Six small Manhattans of Sri Lanka's innings at Newlands. Top row: bars coloured green for overs without a wicket and red for overs with one, shown with normal vision, simulated protanopia and simulated deuteranopia; under both simulations the red and green bars become similar olive-brown shades and the wicket overs are hard to pick out. Bottom row: the book's style (one bar colour plus a marker for each wicket), which stays readable under all three.
Annotation and the phone screen
Kavya's working checklist for a graphic that will be seen on a phone is worth stealing:
- One message per chart. If the chart needs two titles, it is two charts.
- Say the message in the title. "Sri Lanka's chase: required rate passed 10 after over 15" beats "Run rate chart".
- Annotate the moment, not every point. One or two callouts with an arrow ("Tahir: 2 runs, 2 wickets"). The Newlands Manhattan has two, out of forty bars.
- Big type, few ticks. On a 6-inch screen, axis labels below about 10-point type vanish.
tick_step=2in the dashboard exists for this reason. - Direct labels beat legends when there are four series or fewer.
- Portrait-friendly shapes. A tall stack of small multiples works on a phone; a wide 20-column heat map does not — split it, or let it scroll.
- Never two y-axes. A runs bar chart and a wickets line on a second axis invites the reader to compare quantities on unrelated scales; draw two aligned charts instead.
⚠️ Common pitfall: Starting a bar chart's axis above zero to "make the differences visible". It does make them visible — by exaggerating them. Lucknow's overall 9.23 and Punjab's 10.84 differ by 17%; on bars starting at 7.5 the second bar is nearly twice as tall as the first. If the differences are small and matter, use a dot plot (position, no zero needed) or plot the differences themselves.
📋 Try it — Settle this debate: A fan posts the "before" chart with the caption "Delhi Capitals were the best death-overs side of IPL 2026 — look at that bar!" Using the table above, settle it.
Worked answer
Delhi's death-overs run rate was 11.41, which is high but not the highest: Punjab Kings scored 12.55 and Royal Challengers Bengaluru 11.57. The "before" chart misleads in two ways — its truncated axis inflates every difference, and with ten rainbow colours it is easy to read the wrong team's bar. On the dot plot the death markers are on a common scale, sorted rows make Punjab's position obvious, and Delhi's real distinction is visible instead: the biggest gap between a slow powerplay (8.67) and a fast death (11.41). (And remember this is runs per over while batting — team quality at the death also depends on how many wickets were left, which this chart does not show.)
🔄 Check your understanding 1. Why must every wagon wheel or pitch map in this book carry the label "simulated tracking layer — real outcomes, simulated locations"? 2. The simulated Bumrah table shows yorkers making up 27.5% of his death-over dot balls but 5.6% of his boundaries. Why is that not a finding? 3. Name two things the "before" chart in the before-and-after figure does that the "after" chart fixes, and the principle behind each fix.
Answer
- Because the outcomes on those charts are real but the locations are not; without the label, a reader would reasonably take the locations as real and draw conclusions about a real player from invented positions.
- Because the simulation was built to make dot balls more likely to be yorkers and boundaries less likely. The pattern was put into the data by the simulation's rules, so finding it again tells you about the rules, not about Bumrah.
- Any two of: rainbow colours for ten teams → one row per team with direct labels (identity should not depend on matching colours to a legend); alphabetical order → sorted by the value (order should carry information); truncated bar axis → dots on a position scale (length encodings need a zero baseline, position encodings do not); thirty thin bars → three marks per row on a common axis (comparisons belong on a common scale).
Spaced Review
Before you read each answer, try to answer from memory.
From Chapter 3 (Python and pandas): what does groupby("innings")["runs_total"].cumsum() produce, and why could you not get the same thing with groupby("innings")["runs_total"].sum()? — sum() collapses each innings to one number, its total. cumsum() keeps every row and gives the running total within each innings — the score after every ball, which is exactly the y-axis of a worm. Much of this chapter is the difference between those two methods. Revisit Chapter 3 if groupby still feels like magic.
From Chapter 5 (three formats): which chart in this chapter would you not use for a Test match, and what would you use instead? — The Manhattan (and the run-rate chart, which presumes a target and a fixed number of balls). A Test needs charts of the lead and of wickets over time; Case Study 2 builds a "match worm" of England's lead across all four innings at Headingley in 2019. Chapter 5 showed that the three formats have different scoring shapes; their charts must differ too.
From Chapter 6 (statistical thinking): in the diverging heat map, Heinrich Klaasen's powerplay cell (−36 on 52 balls) is far more vivid than Shubman Gill's middle-overs cell (+20 on 514 balls). Which number would you expect to move more if both batters played another season, and what would you do to the cell values before colouring them? — Klaasen's, because 52 balls is a small sample and small samples regress strongly toward the mean. You would shrink each cell toward the league value in proportion to its sample size, as in Chapter 6, or at least print the ball count. The control chart is Chapter 6's idea in visual form, too: most variation is common-cause noise, and you need a clear signal before you claim a change.
Project Checkpoint: charts
Nusrat has a confession. For the first six chapters, every time she wanted a chart in Crease she copied the matplotlib code from the previous chapter and edited it, and by Chapter 6 she had four slightly different worms, three colour schemes and a Manhattan whose wickets sometimes floated above the wrong bar. This chapter fixes that: project/crease/charts.py is now the one place Crease draws pictures, and every later chapter imports it.
The module has 23 public functions in four groups (all documented in the module's docstring):
- Match charts (real data):
match_balls,over_table,innings_labels,match_title,manhattan,worm,run_rate_chart,partnership_table,partnership_bars,match_dashboard,interactive_worm. - Tracking charts (simulated layer):
outcome_class,wagon_wheel,pitch_map,beehive— each labels itself "simulated tracking layer — real outcomes, simulated locations" unless told not to. - Comparison charts:
heatmap,percentile_frame,radar,xmr_limits,control_chart,small_multiples. - Utilities:
style,save, plus the constantsPALETTE,COMPARE,TEAM_COLOURS,OUTCOME_COLOURSandSIM_CAPTION.
Every chart function takes an optional ax and returns it, which is what lets match_dashboard assemble four charts into one figure:
def match_dashboard(balls, match_id, matches=None, chase_innings=2):
style()
m = match_balls(balls, match_id)
fig, axes = plt.subplots(2, 2, figsize=(10, 7.6))
manhattan(m, ax=axes[0, 0], tick_step=2)
worm(m, ax=axes[0, 1])
run_rate_chart(m, innings=chase_innings, ax=axes[1, 0], tick_step=2)
partnership_bars(m, chase_innings, ax=axes[1, 1])
fig.suptitle(match_title(matches, match_id), fontsize=11, fontweight="bold")
return fig
code/project_checkpoint.py tests the module on a match the chapter has not drawn — the IPL 2026 final — and, before drawing anything, checks that the pieces add up to the whole. If the partnerships or the overs do not sum to the innings total, every chart built on them is wrong:
crease.charts — 23 public functions:
beehive, control_chart, heatmap, innings_labels, interactive_worm, manhattan, match_balls, match_dashboard, match_title, outcome_class, over_table, partnership_bars, partnership_table, percentile_frame, pitch_map, radar, run_rate_chart, save, small_multiples, style, wagon_wheel, worm, xmr_limits
Gujarat Titans v Royal Challengers Bengaluru, Narendra Modi Stadium, Ahmedabad, 2026-05-31 — Royal Challengers Bengaluru won by 5 wickets
{1: 'Gujarat Titans 155/8 (20 ov)', 2: 'Royal Challengers Bengaluru 161/5 (18 ov)'}
Innings 1: total 155 | sum of overs 155 | sum of partnerships 155 | batter shares + extras 155 -> OK
Innings 2: total 161 | sum of overs 161 | sum of partnerships 161 | batter shares + extras 161 -> OK
All consistency checks passed.
Partnerships — chasing side
wicket batter_a batter_b runs balls
1 VR Iyer V Kohli 62 27
2 D Padikkal V Kohli 1 4
3 RM Patidar V Kohli 26 19
4 KH Pandya V Kohli 2 3
5 TH David V Kohli 41 31
6 V Kohli JM Sharma 29 24

📊 Figure (described): A four-panel dashboard for the IPL 2026 final (Gujarat Titans 155/8, Royal Challengers Bengaluru 161/5 in 18 overs): Manhattan, worm with the target of 156, Bengaluru's run rate against required rate (the current rate stays well above the required rate throughout), and Bengaluru's partnerships. Virat Kohli is in all six partnerships, starting with a 62-run opening stand off 27 balls.
The partnership table makes one thing obvious without a single extra line of code: Virat Kohli batted through the whole chase and appears in all six stands. (His innings in the data: 75 off 42 balls.)
The checkpoint also draws a simulated wagon wheel for the chase, to prove the tracking functions work end to end — and to prove they label themselves. Later chapters plug in directly: Chapter 8 draws its phase profiles with heatmap; Chapter 9 and Chapter 20 overlay win probability on the worm axis; Chapter 12 extends partnership_table into a network; Chapter 15 builds on pitch_map and beehive; Chapter 27 animates the run_rate_chart; and Chapter 37 turns match_dashboard into broadcast-style graphics. Appendix K, the visualization gallery, collects one example of every chart.
Chapter Summary
| Chart | Answers | Encoding | Best format | Main trap |
|---|---|---|---|---|
| Manhattan | Which overs went for runs; when wickets fell | bar length per over, X per wicket | T20, ODI (grouped) | Bars include extras and say nothing about state |
| Worm | Is the chase ahead of the first innings' path? | cumulative runs as a line | T20, ODI | Not win probability; assumes the first innings is par |
| Run-rate chart | What does the chasing side need from here? | CRR and RRR on one axis | T20, ODI chases | Ignores wickets in hand |
| Partnership bars | Who built the innings, with whom, how fast | stacked bar length | All formats | Runs without the target's context |
| Heat map | How a rate varies across two dimensions | colour + printed value | Any | Vivid colour on tiny samples; missing ≠ zero |
| Small multiples | How many matches/players compare | repeated chart, shared axes | Any | Unshared axes destroy the comparison |
| Control chart | Is this a real change or ordinary noise? | points v natural limits | Season/series data | A signal is not a cause |
| Radar | A player's multi-skill profile | radial position, polygon area | Scouting thumbnails | Area depends on axis order; percentiles depend on pool |
| Wagon wheel / pitch map / beehive | Where the ball was hit / pitched / arrived | position on ground or pitch | All (with real tracking) | Not public — here, simulated and labelled 🧪 |
Decision framework — before you publish a cricket chart:
- What is the question? Pick the chart from the question (Section 7.1's table), not from habit.
- Which format? Don't draw a T20 chart of a Test.
- Is the comparison on a common scale? If not, redesign.
- Is any cell, bar or point resting on a tiny sample? Suppress, label or shrink it.
- Is colour doing a job, and would it survive colour-vision deficiency? Blue/orange, shapes, direct labels.
- Is any of it simulated? Label it, and do not state a simulated number as a fact.
- Does the title say the message — and does the thumb test pass?
What's Next
Part I is complete: you have the data, the code, the statistical habits and now the pictures. Part II turns them on batting. Chapter 8 replaces the batting average with a full set of rate and phase metrics — strike rate, boundary percentage, dot-ball rate — and every profile it draws will come from the heatmap, small_multiples and radar functions you just wrote.