View source: R/annotate_pitch.R
goals_box | R Documentation |
Various functions can be supplied to annotate_pitch
to specify the appearance
of goals in the resulting plot.
goals_box( colour, fill, dimensions, linewidth = 1, alpha = 1, linetype = "solid", offset = 2, ... ) goals_strip( colour, fill, dimensions, linewidth = 1, alpha = 1, linetype = "solid", offset = 1, lineend = "round", ... ) goals_line( colour, fill, dimensions, ..., linewidth = 1, linetype = NULL, relative_width = 3 )
colour |
Colour of pitch outline. |
fill |
Colour of pitch fill. |
dimensions |
A list containing the pitch dimensions to draw. See |
linewidth |
Determines line thickness in |
alpha |
Determines alpha in |
linetype |
Determines linetype in |
offset |
Determines how deep the goal extends. |
... |
Passed onto underlying |
lineend |
Determines lineend in |
relative_width |
Determines relative width of the goal marking to the pitch markings in |
Each function takes colour
, fill
, and dimensions
arguments. User-defined
functions with the same arguments can also be used
list of ggplot geoms to be added to a ggplot plot
library(ggplot2) shots_data <- data.frame(x = c(90, 85, 82, 78, 83), y = c(43, 40, 52, 56, 44)) # Default ggplot(shots_data, aes(x = x, y = y)) + annotate_pitch(goals = goals_box) + geom_point() # Other goals markings ggplot(shots_data, aes(x = x, y = y)) + annotate_pitch(goals = goals_strip) + geom_point() # Partial functions can be used to customise further ggplot(shots_data, aes(x = x, y = y)) + annotate_pitch(goals = ~ goals_box(..., offset = 4)) + geom_point()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.