Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added plot_strike_zone to plotting.py #353

Merged
merged 3 commits into from
Sep 8, 2023

Conversation

nicholson2208
Copy link
Contributor

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

  • relatedly, I added to the pitch_code_to_name_map in pybaseball/utils.py to account for new pitch types this year, (e.g. Sweeper)

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

  • there is nothing to prevent users from trying to use any column as an annotation on the plot, even when it may not fit on the marker

@schorrm schorrm merged commit 6817e58 into jldbc:master Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants