Title: | Plotting Football matches Expected Goals (xG) Stats with 'Understat' Data |
---|---|
Description: | Scrapes footbal match shots data from 'Understat' <https://understat.com/> and visualizes it using interactive plots: - A detailed shot map displaying the location, type, and xG value of shots taken by both teams. - An xG timeline chart showing the cumulative xG for each team over time, annotated with the details of scored goals. |
Authors: | Aymen Nasri [aut, cre, cph] |
Maintainer: | Aymen Nasri <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.2.0 |
Built: | 2025-03-07 01:30:25 UTC |
Source: | https://github.com/aymennasri/ggfootball |
Plot an xG chart of a football match
xg_chart( match_id, home_team_color, away_team_color, competition = "", bg_color = "#FFF1E5", plot_bg_color = "#FFF1E5" )
xg_chart( match_id, home_team_color, away_team_color, competition = "", bg_color = "#FFF1E5", plot_bg_color = "#FFF1E5" )
match_id |
Match ID from understat.com |
home_team_color |
Color used for the home team |
away_team_color |
Color used for the away team |
competition |
Competition name as a subtitle; empty by default. |
bg_color |
Chart background color; defaults to "#FFF1E5" |
plot_bg_color |
Plot background color; defaults to "#FFF1E5" |
Interactive highcharter plot displaying the xG chart of both teams.
xg_chart(26631, "red", "grey", competition = "Premier League")
xg_chart(26631, "red", "grey", competition = "Premier League")
Plot shots xG of a football match
xg_map(match_id, title = "")
xg_map(match_id, title = "")
match_id |
Desired match ID from understat.com |
title |
Plot title; empty by default |
Interactive ggiraph transparent plot displaying both teams shots side by side printed to the Viewer.
xg_map(26631, title = "xG Map")
xg_map(26631, title = "xG Map")