Skip to contents

The function allows for creation of voronoi diagrams on a football pitch with either Opta or Statsbomb data.

Usage

plot_voronoi(
  data,
  data_type = "statsbomb",
  colour = "#E74C3C",
  fill = "",
  alpha = 0.4,
  title = "",
  theme = "dark"
)

Arguments

data

Dataframe that houses pass data. Opta/Statsbomb dataframe must contain atleast the following columns: x, y

data_type

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

colour

The colour of the points in the voronoi plot.

fill

Name of column to add a fill component to the plot

alpha

Alpha value for opacity of fill. Default set to 0.4

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_voronoi(data = data, colour = "blue", title = "Team 1")
plot
}