animateFX | R Documentation |
Pitch trajectories animated on a two-dimensional plot.
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,
...
)
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 |
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.
Returns a series of objects of the class used by package ggplot2 to represent plots.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.