# NOT RUN {
library(ggplot2)
data(statsbomb)
# transform Statsbomb coordinates to metre units for plotting
my_df <- soccerTransform(statsbomb, method = "statsbomb")
# filter events of interest (France defensive pressure events vs. Argentina)
my_df <- my_df %>%
dplyr::filter(team.name == "France" & type.name == "Pressure")
# add custom layers to soccerPitch base
soccerPitch(data = my_df,
arrow = "r", theme = "grass",
title = "France (vs. Argentina)",
subtitle = "Pressure events") +
geom_point(aes(x = location.x, y = location.y),
col = "blue", alpha = 0.5)
# }
Run the code above in your browser using DataLab