Title: Plotting Football Matches Expected Goals (xG) Stats with 'Understat' Data
Version: 0.2.1
Description: Scrapes football 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.
License: GPL (≥ 3)
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: base64enc, dplyr (≥ 1.0.0), gdtools, gfonts, ggiraph, ggplot2, ggsoccer, glue, highcharter, rvest, stringi, stringr, jsonlite, readr, tibble
Depends: R (≥ 4.1.0)
URL: http://aymennasri.me/ggfootball/
BugReports: https://github.com/aymennasri/ggfootball/issues
NeedsCompilation: no
Packaged: 2025-03-22 22:49:49 UTC; aymen
Author: Aymen Nasri [aut, cre, cph]
Maintainer: Aymen Nasri <aymennasrii@proton.me>
Repository: CRAN
Date/Publication: 2025-03-22 23:00:02 UTC

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")