geom_pitch: Pitch background

geom_pitchR Documentation

Pitch background

Description

Adds pitch markings, green background, etc. for plot background to look like a football pitch. ggplot adds things in order so initiate a ggplot object, add the pitch marking with this function, and then add the data you want to add

Usage

geom_pitch(
  nXStart = -60,
  nYStart = -40,
  nXEnd = 60,
  nYEnd = 40,
  mOriginCoordinates = NULL,
  mScreenCoordinates = NULL,
  mViewBeginsFromCoordinates = NULL,
  mVectorPointingUpOnScreen = cbind(0, 0, 1),
  cLineColour = "#BBBBBB",
  cPitchColour = "#038253",
  vcToPlot = c("Markings", "Stripes", "Goalframe", "Goalnet"),
  iXStripes = 12,
  iYStripes = 8,
  nSize = 1
)

Arguments

nXStart

Start x coordinate of the pitch

nYStart

Start y coordinate of the pitch

nXEnd

End x coordinate of the pitch

nYEnd

Start y coordinate of the pitch

cLineColour

the colour of the line markings on the pitch

cPitchColour

the colour of the grass on the pitch

plotObject

a ggplot object. Can just be a blank ggplot object too

Examples

ggplot() + geom_pitch()

thecomeonman/CodaBonito documentation built on April 24, 2023, 11:41 a.m.