jldbc / pybaseball

Pull current and historical baseball statistics using Python (Statcast, Baseball Reference, FanGraphs)
MIT License
1.18k stars 322 forks source link

Added plot_strike_zone to plotting.py #353

Closed nicholson2208 closed 10 months ago

nicholson2208 commented 1 year ago

Description

I added the function plot_strike_zone() to pybaseball/plotting.py so that folks can plot pitch charts in an similar way to the spray charts that already exist

Example Usage

from pybaseball.plotting import plot_strike_zone
from pybaseball import statcast_pitcher

data = statcast_pitcher('2022-09-03', '2022-09-03', 656302)

plot_strike_zone(data.loc[data["pitch_type"] == "SL"], title = "Exit Velocities on Dylan Cease's Slider", colorby='description', annotation="launch_speed")

Strike zone with Dylan Cease's Slider from 2022-09-03 overlaid

Limitations