Description Usage Arguments Examples
View source: R/soccerPassmap.R
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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
)
|
df |
dataframe containing x,y-coordinates of player passes |
lengthPitch, widthPitch |
numeric, length and width of pitch, in metres |
minPass |
minimum number of passes between players for edge to be drawn |
fill, col |
fill and border colour of nodes |
edgeAlpha |
transparency of edge lines, from |
edgeCol |
colour of edge lines. Default is complementary to |
label |
boolean, draw labels |
shortNames |
shorten player names to display last name as label |
maxNodeSize |
maximum size of nodes |
maxEdgeSize |
maximum width of edge lines |
labelSize |
size of player name labels |
arrow |
optional, adds team direction of play arrow as right ( |
theme |
draws a |
title |
adds custom title to plot. Defaults to team name. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 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)")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.