Tuesday 21 March 2017

Display Barrel data from Baseball Savant in Tableau

The MLB Glossary defines a Barreled Ball as follows: To be Barreled, a batted ball requires an exit velocity of at least 98 mph. At that speed, balls struck with a launch angle between 26-30 degrees always garner Barreled classification. For every mph over 98, the range of launch angles expands.

 

To display this in Tableau you need to:

1.     Download some batter data from https://baseballsavant.mlb.com/statcast_search first. Make sure to set the Player Type to Batter and limit the size of the data size by selecting a time frame, position or team from the dropdowns (I used 2016 regular season Blue Jays batters).

2.     Load the data in Tableau and create a point graph with Hit angle on the Rows and Hit speed on the Columns bins.

3.     Add Sv Id to the Details Mark and all batted balls from the dataset will be shown like this:

4.     To follow the definition from Tom Tango, now created a Calculated field with the following calculation:

IF

[Hit Speed] >= 98

AND

[Hit Angle] >= 26 - ([Hit Speed] - 98)

AND

[Hit Angle] <= 30 + ([Hit Speed] -98)

 

THEN "Barrel"

ELSE ""

END

 

5.     By dragging this Calculated Field on the Color mark, we can now see all batted balls defined as Barrels. You can change the shape or graph type to show the data more clearly, and make sure in the color legend to drag Barrels to the top so they are drawn on top in case they overlap with other points:

 

There you go, barrels that expand the angle as the hit speed increases as defined by Tom Tango.




This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.

No comments:

Post a Comment