{ggfootball} is now live!

Demo for my first R package for plotting football stats. (Now available on CRAN!)

R
Football
Package
Published

September 5, 2024

Lifecycle: experimental

Overview

Scrapes shots data from Understat 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.

Installation

You can install {ggfootball} from CRAN with:

install.packages("ggfootball")

Example

library(ggfootball)

# xG chart
xg_chart(match_id = 26631, 
         home_team_color = "red", 
         away_team_color = "grey", 
         competition = "Premier League",
         bg_color = "transparent",
         plot_bg_color = "transparent")
# Shot/xG map
xg_map(match_id = 26631, title = "xG Map")

Acknowledgements