View source: R/direction_label.R
| direction_label | R Documentation | 
Adds an arrow indicating the direction of play to a ggplot plot
direction_label(
  x_label = 50,
  y_label = -3,
  label_length = 20,
  colour = "dimgray",
  linewidth = 0.5,
  linetype = "solid",
  text_size = 3
)
x_label | 
 x position of the centre of the arrow on the plot  | 
y_label | 
 y position of the arrow on the plot  | 
label_length | 
 length of arrow (in x axis units)  | 
colour | 
 colour of the arrow and text  | 
linewidth | 
 thickness of the arrow  | 
linetype | 
 linetype of the arrow  | 
text_size | 
 size of label text (passed onto   | 
list of ggplot layers 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))
p <- ggplot(shots_data, aes(x = x, y = y)) +
  annotate_pitch() +
  geom_point()
# Add direction of play label
p + direction_label()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.