View source: R/geom_mlb_stadium.R
geom_spraychart | R Documentation |
This generates a spraychart - a scatter plot of x, y
values
overlayed on a baseball field. It effectively overrides
geom_point
and additionally concatenates a geom_mlb_stadium
layer.
geom_spraychart(mapping = NULL, data = NULL, stat = "identity",
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, stadium_aes = NULL, 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_aes |
mapping to pass to |
stadium_ids |
character Vector of stadium ids. |
stadium_segments |
character Vector of |
stadium_transform_coords |
boolean if |
... |
other arguments passed on to |
geom_mlb_stadium
g = ggplot() + geom_mlb_
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.