Draw an undirected passing network of completed passes on pitch from StatsBomb data. Nodes are scaled by number of successful passes; edge width is scaled by number of successful passes between each node pair. Only passes made until first substition shown (ability to specify custom minutes will be added soon). Total number of passes attempted and percentage of completed passes shown. Compatability with other (non-StatsBomb) shot data will be added soon.
soccerPassmap(
df,
lengthPitch = 105,
widthPitch = 68,
minPass = 3,
fill = "red",
col = "black",
edgeAlpha = 0.6,
edgeCol = NULL,
label = TRUE,
shortNames = TRUE,
maxNodeSize = 30,
maxEdgeSize = 30,
labelSize = 4,
arrow = c("none", "r", "l"),
theme = c("light", "dark", "grey", "grass"),
title = NULL
)
dataframe containing x,y-coordinates of player passes
numeric, length and width of pitch, in metres
minimum number of passes between players for edge to be drawn
fill and border colour of nodes
transparency of edge lines, from 0
- 1
. Defaults to 0.6
so overlapping edges are visible.
colour of edge lines. Default is complementary to theme
colours.
boolean, draw labels
shorten player names to display last name as label
maximum size of nodes
maximum width of edge lines
size of player name labels
optional, adds team direction of play arrow as right ('r'
) or left ('l'
)
draws a light
, dark
, grey
, or grass
coloured pitch
adds custom title to plot. Defaults to team name.
# NOT RUN {
# France vs. Argentina, minimum of three passes
library(dplyr)
data(statsbomb)
# transform x,y-coords,
# Argentina pass map until first substituton with transparent edges
statsbomb %>%
soccerTransform(method='statsbomb') %>%
filter(team.name == "Argentina") %>%
soccerPassmap(fill = "lightblue", arrow = "r",
title = "Argentina (vs France, 30th June 2018)")
# transform x,y-coords,
# France pass map until first substitution with opaque edges
statsbomb %>%
filter(team.name == "France") %>%
soccerTransform(method='statsbomb') %>%
soccerPassmap(fill = "blue", minPass = 3,
maxEdgeSize = 30, edgeCol = "grey40", edgeAlpha = 1,
title = "France (vs Argentina, 30th June 2018)")
# }
Run the code above in your browser using DataLab