geom_pitch | R Documentation |
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
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
)
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 |
ggplot() + geom_pitch()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.