Skip to contents

This function allows for data, that can be from Opta or StatsBomb, to be used for plotting convex hulls on top of an outline of a football pitch.

Usage

plot_convexhull(
  data,
  data_type = "statsbomb",
  color = "#E74C3C",
  title = "",
  theme = "dark"
)

Arguments

data

Data frame that houses pass data. Opta dataframe must contain atleast the following columns: x, y, finalX, finalY, playerId

data_type

Type of data that is being put in: opta or statsbomb. Default set to "statsbomb"

color

The color of the outline of the convex hull

title

Title of the plot

theme

Indicates what theme the map must be shown in: dark (default), white, rose, almond

Value

a ggplot2 object

Examples

if (FALSE) {
plot <- plot_convexhull(data = data, data_type = "opta", color = "blue", title = "Team 1")
plot
}