Batted Ball Data Visualization

Batted Ball Data Visualization example

Description:

This project is a web application for visualizing batted ball data from baseball games. Users can change the dataset and interactively explore hit locations, launch angles, and exit velocities. Make sure the format of the csv file is the same as the one provided in the BattedBallData.csv file.

How to run the project:

If the CSV file is not available, and you only have the Excel file, please run python3 excel-to-csv.py and have the Excel file be named BattedBallData.xlsx and in the same directory as the python file.

After getting the data, please run a local server. If you are using VS Code, I recommend Live Server since it is an extension. Installation steps for Live Server extension:

  1. Launch VS Code
  2. Quick Open (Ctrl+P) or (Command + P - on Mac)
  3. Paste the following command, and press enter: ext install ritwickdey.liveserver
  4. If prompted, confirm that you do want to install the extension

Open the port where the local server is running, and the visualizations should appear.

What to expect:

After getting everything up and running, you find two visualizations that are similar:

  1. Can be filtered by the outcome of the play, such as single, double, triple, home run, error, fielders choice, sacrifice, out, and other.
  2. Can be filtered to see the plate appearances of each player in the dataset

The circles in the visualizations are the distance the ball traveled and where it lands according to the data. The color in the circle means the outcome of the play.

There is a tooltip that tells you who took the plate appearance, outcome, distance, LA, EV, and hang time. If you click on a circle, it will open the video of the play which it references.

The source code can be found here.