Learn R Programming

soccermatics (version 0.8.4)

soccerDirection: Add an arrow showing the direction of play to a soccer pitch ggplot.

Description

Draws an arrow showing the direction of play at the top of an existing soccer pitch ggplot.

Usage

soccerDirection(plot, direction = c("right", "left"), lengthPitch = 105,
  widthPitch = 68, arrow_col = "black", grass = FALSE, topBuffer = 0)

Arguments

plot

an existing ggplot object to add arrow to.

direction

character, direction of arrow ("right" or "left").

lengthPitch, widthPitch

numeric, length and width of pitch in metres.

arrow_col

character, colour of arrow (defaults to "black").

grass

if TRUE, draws pitch background in green and lines in white. If FALSE, draws pitch background in white and lines in black.

topBuffer

numeric, modify y-position of arrow

Value

a ggplot object

See Also

soccerPitchBG and soccerPitchFG for drawing a soccer pitch

Examples

Run this code
# NOT RUN {
data(tromso)
# draw heatmap of player #9's position
p <- soccerHeatmap(subset(tromso, id == 9), bins = 15, lengthPitch = 105, widthPitch = 68)
# add arrow showing direction of play to the right
soccerDirection(p, "right", lengthPitch = 105, widthPitch = 68)

# }

Run the code above in your browser using DataLab