plot.GameDayPlays: panel.baseball

Description Usage Arguments Details Value Examples

Description

Visualize balls in play

Visualize Balls in Play

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'gameday'
plot(x, ...)

panel.baseball()

## S3 method for class 'GameDayPlays'
plot(x, batterName = NULL, pitcherName = NULL,
  events = NULL, ...)

Arguments

x

An object of class GameDayPlays

...

arguments passed to panel.xyplot

batterName

A character string containing the last name of a batter

pitcherName

A character string containing the last name of a pitcher

events

A vector of MLBAM event types for which to filter. (e.g. 'Home Run')

Details

A convenience function for drawing a generic baseball field using a Cartesian coordinate system scaled in feet with home plate at the origin.

Plots the balls in play from an object of class GameDayPlays. This function will plot (x,y)-coordinates with a generic baseball field plotted in the background. Other lattice options can be passed to xyplot.

Value

an xyplot()

Examples

1
2
3
4
5
6
plot(May)
plot(May, events = c("Single","Double","Triple","Home Run"), pch = 16)
plot(May, batterName = "Trout", main = "Mike Trout's May 2013", pch = 16)
plot(May, pitcherName = "Kershaw", main = "Clayton Kershaw's May 2013", pch = 16)
plot(May, batterName = "Tulowitzki", pitcherName = "Kershaw", 
     main = "Clayton Kershaw versus Troy Tulowitzki: May 2013", pch = 16, cex = 3)

beanumber/openWAR documentation built on May 12, 2019, 9:43 a.m.