# NOT RUN {
library(ggplot2)
library(dplyr)
data(statsbomb)
# normalise data, get non-penalty shots for France,
# add boolean variable 'goal' for plotting
my_df <- statsbomb %>%
soccerTransform(method = 'statsbomb') %>%
filter(team.name == "France" &
type.name == "Shot" &
shot.type.name != 'penalty') %>%
mutate(goal = as.factor(if_else(shot.outcome.name == "Goal", 1, 0)))
soccerPitchHalf(data = my_df, theme = 'light') +
geom_point(aes(x = location.y, y = location.x,
size = shot.statsbomb_xg, colour = goal),
alpha = 0.7)
# }
Run the code above in your browser using DataLab