View source: R/geom_mlb_stadium.R
geom_mlb_stadium | R Documentation |
This draws the outline of an MLB stadium.
geom_mlb_stadium(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = FALSE, stadium_ids = NULL,
stadium_segments = "outfield_outer", stadium_transform_coords = FALSE,
...)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
stadium_ids |
mapping to pass to 'If |
params |
Additional parameters to the |
The data are based on the SVG files used by MLBAM. The SVG files have been
converted to a data.frame
for use with ggplot2::geom_path
geom_spraychart
set.seed(101)
batted_ball_data = data.frame(hc_x = rnorm(20, 125, 10), hc_y=rnorm(20, 100, 20))
batted_ball_data$team = rep(c("angels", "yankees"), each=10)
g <- ggplot(batted_ball_data) + geom_spraychart(aes(x=hc_x, y=hc_y), stadium_ids = "angels")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.