Pitch Location Charts with PITCHf/x and ggplot

Visually analyze each at-bat of a baseball game.
Rating: 4.9 out of 5 (97 ratings)
5,250 students
Pitch Location Charts with PITCHf/x and ggplot
Rating: 4.9 out of 5 (97 ratings)
5,250 students
scrape PITCHf/x data into an R session
plot pitch locations with ggplot
visualize pitch type and speed with ggplot
subset vectors in R
work with color in ggplot
facet in ggplot
label with geom_text
work with seq, lapply, unlist, and unique in R
save plots as png's
write for loops in R
work with factors in R

Requirements

  • Students will need to have R and RStudio installed on their own computers.

Description

In this course, we make use of PITCHf/x data to create pitch location charts for a given baseball game. We break the game out into each at-bat and visualize the location, type, and speed of each pitch, the order in which the pitches were thrown, and the outcome of the at-bat.

In order to accomplish this, we will be taking a deep dive into ggplot. We will learn much about how to work with color, how to use aesthetics, and how to facet. We will also gain additional R skills, such as how to subset a vector and how to work with factors.

One should be able to complete the course, at a relaxed pace, in about three weeks. It is best if students already have a little bit of a background in R, dplyr, and ggplot, but it is not completely necessary.

Who this course is for:

  • This course is for students interested in learning how to create pitch location charts and how to wrangle data from PITCHf/x.
  • It would be best for each student to have a bit of a background in R, dplyr, and ggplot, but it is not completely necessary.

Course content

6 sections • 37 lectures • 2h 11m total length
  • Introduction
    01:01
  • PITCHf/x Data
    04:14
  • Scraping the Data
    04:50
  • Joining the atbat and pitch Data Frames
    04:46
  • Choosing Columns from the atbat Data Frame
    04:39
  • Choosing Columns from the pitch Data Frame
    02:31

Instructor

Professor at Mercyhurst University
Charles Redmond
  • 4.6 Instructor Rating
  • 5,902 Reviews
  • 72,311 Students
  • 7 Courses

Dr. Charles Redmond is a professor in the Tom Ridge School of Intelligence Studies and Information Science at Mercyhurst University. He has been a member of the Department of Mathematics and Computer Systems at Mercyhurst for 21 years and has recently completed a term as chair of the department. Dr. Redmond received his PhD in mathematics from Lehigh University in 1993 and has published in the Annals of Applied Probability, the Journal of Stochastic Processes and Their Applications, Mathematics Magazine, the College Mathematics Journal, and Mathematics Teacher. In his spare time he enjoys making music and computer generated art, reading, and owning a Clumber Spaniel.