Description Usage Arguments Value Examples
Draws a path connecting consecutive x,y-coordinates of a player on a soccer pitch.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
df |
dataframe containing x,y-coordinates of player position |
lengthPitch, widthPitch |
length and width of pitch in metres |
col |
colour of path if no |
arrow |
adds team direction of play arrow as right ( |
theme |
draws a |
lwd |
player path thickness |
title, subtitle |
adds title and subtitle to plot; NULL by default |
legend |
boolean, include legend |
x, y |
name of variables containing x,y-coordinates |
id |
character, the name of the column containing player identity (only required if |
plot |
base plot to add path layer to; NULL by default |
a ggplot object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library(dplyr)
data(tromso)
# draw path of Tromso #8 over first 3 minutes (1800 frames)
tromso %>%
filter(id == 8) %>%
top_n(1800) %>%
soccerPath(col = "red", theme = "grass", arrow = "r")
# draw path of all Tromso players over first minute (600 frames)
tromso %>%
group_by(id) %>%
slice(1:1200) %>%
soccerPath(id = "id", theme = "light")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.