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:

report = corner_report(events, model=model)
report
contestantId attempts successful success_rate second_phases second_phase_goals second_phase_rate retention_rate total_added_value avg_added_value goals
0 cxb4hqite921i36gwrezdts7c 2 1 0.500 0 0 0.000 0.500 -0.0192 -0.0096 0
1 f2yd0yzt0om6qhks9gbowu1d6 7 1 0.143 2 0 0.286 0.429 0.0000 0.0000 0


fig, ax = plot_set_piece_radar(report, title="Corner profile")
plot 12 set piece report radar

Same for free kicks:

fk_report = free_kick_report(events, model=model)
fig, ax = plot_set_piece_radar(fk_report, title="Free-kick profile")
plot 12 set piece report radar

Gallery generated by Sphinx-Gallery