diff --git a/DESCRIPTION b/DESCRIPTION index d9ffdc8..014f37b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: soccermatics Version: 0.9.0 Authors@R: person("Joe", "Gallagher", email = "joedgallagher@gmail.com", role = c("aut", "cre")) -Title: Visualise spatial data from soccer matches -Description: Provides tools to visualise x,y-coordinates of soccer players in the manner presented in David Sumpter's eponymous book. Uses ggplot to draw soccer pitch and overplot player trajectories, average player positions, heatmaps of player position, flow fields to show binned player movement or passing, and more. +Title: Visualise tracking and event data from soccer matches +Description: Provides tools to visualise x,y-coordinates of soccer players and event data (passes, shots). Uses ggplot to draw soccer pitch and overplot expected goal maps, pass maps, average player positions, player heatmaps, individual player paths, player flow fields, and more. Depends: R (>= 3.4.1) Imports: dplyr, magrittr, ggplot2, ggforce, zoo License: GPL (>=3.0) Note: Use of the name 'soccermatics' was kindly permitted by David Sumpter and is protected from commercial use under EU copyright law. diff --git a/dev/soccerPassmap.R b/dev/soccerPassmap.R deleted file mode 100644 index b265a1d..0000000 --- a/dev/soccerPassmap.R +++ /dev/null @@ -1,42 +0,0 @@ -library(soccermatics) - -# get data -url <- "http://s3-irl-epl.squawka.com/dp/ingame/32991" -dat <- getPasses(url) - -# set pitch dimensions -pitchLength <- 101 -pitchWidth <- 68 - -# scale x,y-coords to pitch size -dat$x.start <- dat$x.start * (pitchLength / 100) -dat$x.end <- dat$x.end * (pitchLength / 100) -dat$y.start <- dat$y.start * (pitchWidth / 100) -dat$y.end <- dat$y.end * (pitchWidth / 100) - -# subset one player -dd <- subset(dat, dat$passer == "Jordan Henderson") - -# plot -p <- soccerPitchBG(pitchLength, pitchWidth) - -p + - geom_segment(data = dd, aes(x = x.start, xend = x.end, y = y.start, yend = y.end, col = as.factor(completed)), size = 1, alpha = 0.75, arrow = arrow(length = unit(0.15, "cm"))) + - guides(col = FALSE) - - -# pass network -dd <- subset(dat, dat$team == "Liverpool") - -dd$name <- stringr::str_extract(dd$passer, '\\w+$') - -pos <- dd %>% - group_by(name) %>% - summarise(x = mean(x.start), y = mean(y.start), n = n()) %>% - arrange(desc(n)) %>% - head(11) - -p + - geom_point(data = pos, aes(x, y), shape = 21, size = 6, colour = "black", fill = "red", stroke = 1) + - geom_point(data = pos, aes(x, y), shape = 21, size = 6, colour = "black", fill = NA, stroke = 1) + - geom_text(data = pos, aes(x, y, label = name), hjust=0.5, vjust=2, size = 3.7) diff --git a/soccermatics.pdf b/soccermatics.pdf index 09b6804..08f29be 100644 Binary files a/soccermatics.pdf and b/soccermatics.pdf differ