Package 'ggfootball'

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

Help Index


Plot an xG chart of a football match

Description

Plot an xG chart of a football match

Usage

xg_chart(
  match_id,
  home_team_color,
  away_team_color,
  competition = "",
  bg_color = "#FFF1E5",
  plot_bg_color = "#FFF1E5"
)

Arguments

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"

Value

Interactive highcharter plot displaying the xG chart of both teams.

Examples

xg_chart(26631, "red", "grey", competition = "Premier League")

Plot shots xG of a football match

Description

Plot shots xG of a football match

Usage

xg_map(match_id, title = "")

Arguments

match_id

Desired match ID from understat.com

title

Plot title; empty by default

Value

Interactive ggiraph transparent plot displaying both teams shots side by side printed to the Viewer.

Examples

xg_map(26631, title = "xG Map")