kruser/pitchfx-site — pull request #66 by albertlyu (2014-04-12 20:29:58+00:00)
Title: adding contact and per swing heatmaps, functions, and karma tests

Karma tests include contact/swing, fouls/swing, and bip/swing functions. Also reorganizing accordion to the following order:

Pitch Results
* Swing Rate
* Contact Rate
* Whiff Rate
* Called Strike Rate
* ~~Foul Rate~~ (removing this to create space, but the getFoulRate functions still exist for now)
* Ball In Play Rate

Swing Results
* Contact/Swing
* Whiffs/Swing
* Fouls/Swing
* BIP/Swing

Batted Ball Results
* Grounders/BIP
* Linedrives/BIP
* Flyballs/BIP
* Popouts/BIP

Sabermetric Results
* wOBA/BIP
* BABIP

A great test case is comparing the charts of Brett Gardner and Mark Reynolds. Reynolds swings at a lot of pitches in and out of the zone compared to Gardner, and as a result, whiffs on a lot of them. Reynolds particularly like to swing at pitches up in (and out) of the zone, so his whiff rate chart shows some red in up in the zone.

Looking at the swing results, even though Gardner is more selective in his swinging, he's a lot better at making contact than Reynolds is. Just as compelling is Gardner's whiff/swing chart vs. Reynolds' whiff/swing charts. So Gardner 1) doesn't like swinging at out of zone pitches, and 2) is better than average at making contact at all pitches when he does swing. Reynolds 1) likes to swing at all pitches, in the zone and out of zone, and 2) is not great at making contact when he does swing. Stark contrast.

An extension to these heatmaps would be incorporating more sabermetric results in addition to wOBA, but I can focus my efforts on #39 after this potential update. Let me know what you think of this @kruser, and if you like the addition or if it needs a little more work.