Description Usage Arguments Details References Examples
These functions add pitch annotations to better visualize match-event data.
They utilize a series of geom
annotations and can be customized by
color and fill. These annotations integrate with coord_flip()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | fc_annotate_pitch(
dimensions = c(105, 70),
palette = "gw",
color = NULL,
fill = NULL,
coord_flip = FALSE
)
fc_annotate_arrow(
x,
y,
arrow_length = 20,
palette = "gw",
color = NULL,
coord_flip = FALSE
)
|
dimensions |
A numeric vector of length two for pitch dimensions. The default of (105, 70) is close to the regulation size of the EPL. |
palette |
A color palette character vector of length one, often paired with a corresponding theme function. Options include: "bw", "classic", "dark", "gw", "smurf", "wc". |
color |
A color name or hex character value. This will override any
set |
fill |
A color name or hex character value. This will override any
set |
coord_flip |
A logical vector of length one. Set to |
x |
The x location for the arrow's position. |
y |
The y location for the arrow's position. |
arrow_length |
The total length of the arrow. |
fc_annotate_pitch()
Adds a soccer pitch with all field markings.
fc_annotate_arrow()
Adds an arrow indicating the direction of attack. A text label classifying this direction as "east" is also included.
Pappalardo, L., Cintia, P., Rossi, A. et al. A public data set of spatio-temporal match events in soccer competitions. Sci Data 6, 236 (2019). https://doi.org/10.1038/s41597-019-0247-7
All public Wyscout data is available at https://figshare.com/collections/Soccer_match_event_dataset/4415000/2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # load ggplot2
library(ggplot2)
ggplot() +
fc_annotate_pitch() +
theme_void()
ggplot() +
fc_annotate_pitch() +
fc_annotate_arrow(x = 52.5, y = -5) +
theme_void()
ggplot() +
fc_annotate_pitch(palette = "smurf") +
fc_annotate_arrow(x = 52.5, y = -5, palette = "smurf") +
fc_theme_smurf()
ggplot() +
fc_annotate_pitch(palette = "smurf", coord_flip = TRUE) +
fc_annotate_arrow(x = 52.5, y = -5, palette = "smurf", coord_flip = TRUE) +
coord_flip() +
fc_theme_smurf()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.