Skip to contents

This function allows you to plot various types of heatmaps of starting x and y coordinates: hex binwidth heatmap, density heatmap, and binwidth heatmap

Usage

plot_heatmap(
  data,
  type = "",
  data_type = "statsbomb",
  binwidth = 20,
  theme = ""
)

Arguments

data

The dataframe that stores your data. Dataframe must contain atleast the following columns: x, y.

type

indicates the type of heatmap to plot. "hex" indicates hex bins, "density" indicates density (default), "binwidth" indicates binwidth heatmap pass, and "jdp" indicates a binned heatmap according jdp pitch markings.

data_type

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

binwidth

indicates the size of the bin width to construct heatmap for type "binwidth". The same argument name as the underlying call to geom_bin2d(). Default set to 20.

theme

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

Value

returns a ggplot2 object

Examples

if (FALSE) {
plot <- plot_heatmap(data = touchData, type = "hex")
plot
}