Learn R Programming

soccermatics (version 0.9.0)

soccerShotmap: Draw a shotmap on a half pitch from StatsBomb data

Description

Draw a shotmap on a half pitch from StatsBomb data. Compatability with other (non-StatsBomb) shot data will be added soon.

Usage

soccerShotmap(dat, lengthPitch = 105, widthPitch = 68,
  colGoal = "skyblue", colMiss = "grey60", alpha = 0.8, legend = FALSE,
  theme = c("light", "dark", "grass"), lwd = 0.5)

Arguments

lengthPitch, widthPitch

length and width of pitch in metres

colGoal, colMiss

colour of points representing scored and missed shots

alpha

transparency of points

legend

boolean, include legend or not

lwd

numeric, pitch line width

fillPitch, colPitch

pitch background and line colour

grass

if TRUE, uses a more realistic pitch

Value

a ggplot object

See Also

soccerPitchBG for drawing a soccer pitch as foreground over an existing ggplot object

Examples

Run this code
# NOT RUN {
data(statsbomb)

# shot map of France vs. Argentina (2018-06-30)
statsbomb %>% 
  filter(team.name == "France") %>% 
  soccerShotmap()

# }

Run the code above in your browser using DataLab