Description Usage Arguments Value Examples
View source: R/soccerShotmap.R
If df
contains two teams, draws a shotmap of each team at either end of a full pitch. If df
contains one or more players from a single team, draws a vertical half pitch. Currently only works with StatsBomb data but compatability with other (non-StatsBomb) shot data will be added soon.
1 2 3 4 5 6 7 8 9 10 11 12 |
df |
dataframe containing x,y-coordinates of player passes |
lengthPitch, widthPitch |
length and width of pitch, in metres |
homeTeam |
if |
adj |
adjust xG using conditional probability to account for multiple shots per possession |
n_players |
number of highest xG players to display |
size_lim |
minimum and maximum size of points, |
title, subtitle |
optional, adds title and subtitle to half pitch plot. Title defaults to scoreline and team identity when two teams are defined in |
theme |
draws a |
a ggplot object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data(statsbomb)
# shot map of two teams on full pitch
statsbomb %>%
soccerTransform(method='statsbomb') %>%
soccerShotmap(theme = "gray")
# shot map of one player on half pitch
statsbomb %>%
dplyr::filter(player.name == "Antoine Griezmann") %>%
soccerTransform(method='statsbomb') %>%
soccerShotmap(theme = "grass",
title = "Antoine Griezmann",
subtitle = "vs. Argentina, World Cup 2018")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.