Nothing
## ----setup, include=TRUE-------------------------------------------------
## ------------------------------------------------------------------------
library(mlbgameday)
library(dplyr)
# Grap some Gameday data. We're specifically looking for Jake Arrieta's no-hitter.
gamedat <- get_payload(start = "2016-04-21", end = "2016-04-21")
# Subset that atbat table to only Arrieta's pitches and join it with the pitch table.
pitches <- inner_join(gamedat$pitch, gamedat$atbat, by = c("num", "url")) %>%
subset(pitcher_name == "Jake Arrieta")
## ------------------------------------------------------------------------
library(ggplot2)
# basic example
ggplot() +
geom_point(data=pitches, aes(x=px, y=pz, shape=type, col=pitch_type)) +
coord_equal() + geom_path(aes(x, y), data = mlbgameday::kzone)
## ---- fig.show='hold'----------------------------------------------------
# basic example with stand.
ggplot() +
geom_point(data=pitches, aes(x=px, y=pz, shape=type, col=pitch_type)) +
facet_grid(. ~ stand) + coord_equal() +
geom_path(aes(x, y), data = mlbgameday::kzone)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.