Soccer Analytics with StatsBomb & xG
Pass maps, shot maps, heatmaps and pass networks from free pro event data — then a complete World Cup: scoring by stage and a Poisson scoreline model.
Soccer's analytics revolution runs on event data, and StatsBomb gives a professional-grade slice of it away free. This course builds the four canonical match visualizations — pass map, xG shot map, player heatmap, team pass network — then closes on a real tournament: the complete 2026 World Cup, all 104 matches bundled, first read stage by stage with a groupby, then turned into the classic Poisson scoreline model that grids every possible final score with a probability.
An xG league table from Understat data rounds out the toolkit — the single most useful number for judging whether a team's results are sustainable. And because this course leans on xG so hard, it also audits it: one build checks StatsBomb's own numbers against every shot of a World Cup before asking you to trust them.
What you'll be able to do
- Navigate StatsBomb event data and know what's in it
- Draw pass maps, shot maps and heatmaps on a properly scaled pitch
- Build a team pass network and read its structure
- Construct an xG table and argue from it
- Audit a published xG model's calibration with Wilson intervals and a Brier score
- Fit a Poisson scoreline model and turn a fixture into win/draw/loss odds
The bundle contains each part's finished script, the shared helpers, and the sample data they read, with a README listing the run order - the whole course works offline.
The syllabus
Pace: In order for the first two parts, then free order. The two World Cup parts are the payoff - a real tournament in your hands; take them last, in order.
0 of 8 parts marked complete on this device.
Every part of this course is marked complete on this device. The capstone below is the victory lap - and the quiz will tell you if anything slipped.
- Build an xG League Table from Understat DataxG against the table: the sustainability check every result needs.
- Draw a Pass Map with mplsoccerEvent data made visible - your first professional-grade match graphic.
- Build a Match Shot Map with Expected GoalsChance quality on the pitch map, not just the scoreline.
- Is xG Calibrated? Checking a Published Model Against 1,494 Real ShotsThe audit: does 0.10 xG really mean 10%? A whole World Cup, checked.
- Draw a Player Heatmap from Event DataWhere a player actually operated, from raw event coordinates.
- Build a Team Pass NetworkTeam structure as a graph - who really connects the play.
- Group vs Knockout Scoring at the 2026 World Cup, with groupbyThe complete 2026 World Cup, one groupby, a real finding.
- Predict a Scoreline with Poisson: the World Cup Final as a GridThe finale: a model that gave the final's exact score a 30% chance.
Check yourself
Five questions, graded on the page, nothing recorded anywhere - pick an answer and the explanation appears.
1. Expected goals (xG) measures…
Each shot gets a probability from location, angle and situation. Summed, it says how many goals the chances 'should' produce on average.
2. A team running far ahead of its xG for several matches is…
Sustained overperformance of chance quality is mostly finishing variance, and it tends to fall back - which is why xG tables predict future results better than league tables.
3. In a pass network, node size and edge thickness typically encode…
The graph is built from passing events: who touched the ball, and who moved it to whom, how often.
4. StatsBomb open data is…
It's genuine pro-level event data released free for public use - the attribution requirement is the licence's main ask.
5. How does a team win 1-0 while 'losing' the xG battle?
Ninety minutes is a tiny sample. Good chances get missed and half-chances go in - which is exactly why xG and the scoreline diverge in single games.
Where next: Statistics for Sports Data · Sports Data Visualization.