Note
Go to the end to download the full example code.
Corner/free-kick report + radar
wa_setpieces.corner_report() (and free_kick_report) merges
attempts, success rate, second-phase rate, retention rate, and – with a
fitted xT model – added value and goals into one table per team. Handed
to plot_set_piece_radar(), it becomes a one-glance
profile comparison, in the same spirit as a scouting radar/pizza chart.
from pathlib import Path
from wa_setpieces import corner_report, free_kick_report, load_matches
from wa_setpieces.viz.plots import plot_set_piece_radar
from wa_setpieces.core.xt import XTModel
try:
_here = Path(__file__).resolve().parent
except NameError:
_here = Path.cwd()
DATA = _here.parent / "tests" / "data" / "sample_match.json"
events = load_matches(DATA)
model = XTModel.fit(events, x_bins=8, y_bins=6)
The full corner report – one row per team:
fig, ax = plot_set_piece_radar(report, title="Corner profile")

Same for free kicks: