Skip to contents

The data can be scraped from FBref.
Dataframe passed in must have the following column names:

Date (format: year-month-day).yyyy-mm-dd,
Home_xG (xG for Home Team),
Away_xG (xG for Away Team),
Home (Home Team),
Away (Away Team)

Usage

plot_trendline(data, team, color_xg, color_xga, rolling_average, theme = "")

Arguments

data

is for the dataset used. Select the number of matches wanted in the viz beforehand.

team

is to select the specific team for the viz. Team must be accurate as per FBref specifications.

color_xg

is for selecting color for xGoals.

color_xga

is for selecting the color for xGoalsAgainst.

rolling_average

is for setting the rolling average for the data.

theme

to select the theme from 4 options -> dark, almond, rose, white.

Details

For best clarity, export plot as a 2000x1000 png

Examples

if (FALSE) {
plot <- plot_trendline(data = pl, team = "Tottenham",
                       color_xg = "#08519c", color_xga = "#cb181d",
                       rolling_average = 10, theme = "dark")
plot
}