Skip to contents

This function allows for data, that has to be scraped from FBref, to be used for plotting single and comparison percentile plots.

Usage

plot_pizza(
  data,
  type = "",
  template,
  color_possession = "#41ab5d",
  color_attack = "#2171b5",
  color_defense = "#fec44f",
  player_1,
  player_2,
  color_compare = "#41ab5d",
  season = "Last 365 Days Men's Big 5 Leagues, UCL, UEL",
  season_player_1 = "Last 365 Days Men's Big 5 Leagues, UCL, UEL",
  season_player_2 = "Last 365 Days Men's Big 5 Leagues, UCL, UEL",
  theme = ""
)

Arguments

data

Data frame can contain either one player or two depending on the type of plot made

type

Type of plot -> single and comparison

template

Selecting a group of pre-selected metrics for each position by position namely: outfielder, goalkeeper and custom

color_possession

Selecting the color for possession group of stats. To be used only for single player plot

color_attack

Selecting the color for attacking group of stats. To be used only for single player plot

color_defense

Selecting the color for defense group of stats. To be used only for single player plot

player_1

Selecting the first player. To be used only for comparison plot

player_2

Selecting the second player. To be used only for comparison plot

color_compare

Selecting the color of comparison to be used only for comparison plot

season

Specify what season to pick for a single player pizza chart. Pick the scouting period from the scouting period column in the data

season_player_1

Specify what season to pick for the first player in a pizza chart

season_player_2

Specify what season to pick for the second player in a pizza chart

theme

Specify the theme of the pizza chart -> dark, black, and white. Default set to dark

Value

a ggplot2 object

Details

For best image quality use: ggsave("image.png", width = 2900, height = 2800, units = "px")

Examples

if (FALSE) {
plot1 <- plot_pizza(data = data, type = "comparison", template = "outfielder",
                    player_1 = "Nicolo Barella", player_2 = "Ilkay Gundogan",
                    season_player_1 = "Last 365 Days Men's Big 5 Leagues, UCL, UEL", 
                    season_player_2 = "Last 365 Days Men's Big 5 Leagues, UCL, UEL",
                    color_compare = "lightgreen", theme = "black")
plot1

plot2 <- plot_pizza(data = data1, type = "single", template = "outfielder",
                    color_possession = "green", color_attack = "lightblue", 
                    season = "Last 365 Days Men's Big 5 Leagues, UCL, UEL",
                    color_defense = "red", theme = "dark")
plot2
}