Skip to contents

This function allows for data, that has to be scraped from Understat, to be used for plotting shots.

Usage

plot_shot(
  data,
  type = "",
  bins = 30,
  highlight_goals = "",
  average_location = "",
  theme = ""
)

Arguments

data

Dataframe that houses shot data. Dataframe must contain atleast the following columns: X,Y,xG,result,name

type

Type of showcasing the shotmap: hexbin, density, point (default)

bins

Bin size for creating bins. Use this when using hexbin shotmap. The same argument name as the underlying call to geom_hex(). Default = 30.

highlight_goals

to choose to display only the goals in a different color.

average_location

for removing lines denoting average location of shots if need be.

theme

Theme preferences for display: dark (default), white, rose, almond

Value

a ggplot2 object

Examples

if (FALSE) {
plot <- plot_shot(data, type = "hexbin", bins = 20, 
average_location = TRUE, highlight_goals = FALSE)
}