animateFX: Animate PITCHf/x

Description Usage Arguments Details Value Examples

Description

Pitch trajectories animated on a two-dimensional plot.

Usage

1
2
3
animateFX(data, color = "pitch_types", avg.by, point.alpha = 1/3,
  limitz = c(-3.5, 3.5, 0, 7), flag = FALSE, interval = 0.01,
  layer = list(), parent = FALSE, ...)

Arguments

data

data frame with appropriately named PITCHf/x variables

color

variable used to control coloring scheme.

avg.by

variable used as an index for averaging over PITCHf/x parameters

point.alpha

ggplot2 alpha parameter

limitz

limits for horizontal and vertical axes.

flag

indicate whether or not batter has decided to swing.

interval

time (in seconds) between plotting the pitch locations.

layer

list of ggplot2 layer modifications.

parent

is the function being called from a higher-level function? (experimental)

...

extra options passed onto geom commands

Details

animateFX plots a series of "snapshots" that represent pitch trajectories from the point of release until all of them reach home plate. The graphic takes on the viewpoint of the umpire; that is, the pitches are getting closer to the viewer with time. This is relected with the increase in size of the "balls" as the animation progresses.

Value

Returns a series of objects of the class used by package ggplot2 to represent plots.

Examples

1
2
3
4
5
6
7
8
9
data(pitches)
#generate animation and prompt default web browser to view the sequence of plots
## Not run: 
animation::saveHTML({ animateFX(pitches, layer = facet_grid(pitcher_name~stand)) })
animation::saveHTML({ animateFX(pitches, avg.by="pitch_types",
                         layer = facet_grid(pitcher_name~stand))
                   })

## End(Not run)

pitchRx documentation built on May 2, 2019, 5:56 a.m.

Related to animateFX in pitchRx...