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()
Run the code above in your browser using DataLab