# Filter the data for the pitcher Falter
Falter_data <- Newport65 %>%
filter(Pitcher == "Falter, Nick")
# Create a detailed table for each pitch
detailed_pitch_table <- Falter_data %>%
select(AutoPitchType, RelSpeed, SpinRate, SpinAxis, HorzBreak, InducedVertBreak, PitchCall) %>%
rename(
ReleaseSpeed = RelSpeed,
Tilt = SpinAxis,
HorizontalBreak = HorzBreak,
InducedVerticalBreak = InducedVertBreak
) %>%
mutate(
ReleaseSpeed = round(ReleaseSpeed, 2),
SpinRate = round(SpinRate, 2),
Tilt = round(Tilt, 2),
HorizontalBreak = round(HorizontalBreak, 2),
InducedVerticalBreak = round(InducedVerticalBreak, 2),
ClockTilt = round((Tilt / 30) %% 12, 1) # Interpret Tilt as clock face
)
# Display the detailed table
knitr::kable(detailed_pitch_table, caption = "Detailed Pitch Table for Falter")
Detailed Pitch Table for Falter
Sinker |
92.78 |
2199.72 |
238.39 |
18.19 |
12.21 |
BallCalled |
7.9 |
Four-Seam |
88.82 |
2412.81 |
204.62 |
7.01 |
16.35 |
BallCalled |
6.8 |
Four-Seam |
87.84 |
2386.61 |
190.93 |
2.65 |
14.85 |
FoulBallNotFieldable |
6.4 |
Cutter |
85.07 |
2223.21 |
190.78 |
2.19 |
13.02 |
StrikeSwinging |
6.4 |
Four-Seam |
93.79 |
2401.06 |
216.15 |
14.51 |
21.01 |
FoulBallNotFieldable |
7.2 |
Sinker |
93.01 |
2382.88 |
240.98 |
19.38 |
11.89 |
InPlay |
8.0 |
Four-Seam |
92.89 |
2460.85 |
221.13 |
17.03 |
20.71 |
StrikeCalled |
7.4 |
Four-Seam |
88.51 |
2405.49 |
204.11 |
7.14 |
17.15 |
Undefined |
6.8 |
Slider |
85.71 |
2356.76 |
214.23 |
4.97 |
8.35 |
FoulBallNotFieldable |
7.1 |
Slider |
84.30 |
2212.65 |
224.92 |
3.21 |
4.80 |
InPlay |
7.5 |
Cutter |
88.16 |
2248.21 |
202.61 |
3.95 |
10.69 |
FoulBallNotFieldable |
6.8 |
Slider |
83.30 |
2164.26 |
191.66 |
1.39 |
7.96 |
BallCalled |
6.4 |
Four-Seam |
93.83 |
2461.89 |
222.46 |
15.22 |
17.73 |
BallCalled |
7.4 |
Changeup |
86.48 |
1732.09 |
263.62 |
16.41 |
3.03 |
BallCalled |
8.8 |
Sinker |
94.47 |
2432.58 |
233.05 |
17.21 |
13.97 |
BallCalled |
7.8 |
Four-Seam |
93.45 |
2437.98 |
217.37 |
14.94 |
20.70 |
BallCalled |
7.2 |
Four-Seam |
89.30 |
2323.54 |
199.37 |
4.64 |
14.29 |
FoulBallNotFieldable |
6.6 |
Changeup |
86.67 |
1583.31 |
265.67 |
16.78 |
2.55 |
BallCalled |
8.9 |
Changeup |
85.80 |
1624.64 |
251.09 |
16.82 |
7.00 |
InPlay |
8.4 |
Sinker |
93.72 |
2135.37 |
230.03 |
17.38 |
15.65 |
BallCalled |
7.7 |
Four-Seam |
89.54 |
2274.49 |
207.36 |
6.29 |
13.36 |
StrikeSwinging |
6.9 |
Sinker |
93.57 |
2176.06 |
243.20 |
20.08 |
11.23 |
StrikeSwinging |
8.1 |
Four-Seam |
95.12 |
2478.34 |
223.28 |
17.16 |
19.39 |
FoulBallNotFieldable |
7.4 |
Four-Seam |
95.06 |
2510.84 |
222.97 |
16.95 |
19.41 |
StrikeSwinging |
7.4 |
Sinker |
92.81 |
2478.33 |
223.96 |
16.54 |
18.50 |
Undefined |
7.5 |
Four-Seam |
87.04 |
2351.94 |
206.36 |
6.18 |
13.72 |
BallCalled |
6.9 |
Slider |
86.17 |
2357.90 |
183.46 |
0.61 |
11.44 |
BallCalled |
6.1 |
Sinker |
91.59 |
2465.91 |
227.53 |
16.22 |
16.20 |
StrikeCalled |
7.6 |
Sinker |
91.56 |
2159.52 |
242.28 |
18.96 |
11.26 |
InPlay |
8.1 |
Sinker |
91.95 |
2214.08 |
230.17 |
17.69 |
16.01 |
StrikeSwinging |
7.7 |
Sinker |
92.38 |
2202.92 |
233.48 |
18.57 |
15.04 |
StrikeCalled |
7.8 |
Changeup |
85.49 |
1611.90 |
278.70 |
19.16 |
-1.50 |
StrikeSwinging |
9.3 |
Four-Seam |
87.12 |
2285.97 |
192.06 |
2.88 |
14.81 |
InPlay |
6.4 |
Four-Seam |
92.23 |
2440.20 |
225.16 |
16.04 |
17.33 |
FoulBallNotFieldable |
7.5 |
Changeup |
84.35 |
1775.95 |
251.99 |
15.64 |
6.43 |
InPlay |
8.4 |
Four-Seam |
91.87 |
2422.83 |
231.61 |
18.76 |
16.17 |
BallCalled |
7.7 |
Four-Seam |
92.34 |
2396.74 |
217.79 |
13.62 |
18.82 |
StrikeCalled |
7.3 |
Changeup |
85.79 |
1869.57 |
248.73 |
19.99 |
9.25 |
InPlay |
8.3 |
Sinker |
91.66 |
2267.47 |
244.38 |
19.43 |
10.60 |
BallCalled |
8.1 |
Four-Seam |
92.63 |
2485.62 |
217.26 |
14.41 |
20.17 |
Undefined |
7.2 |
Four-Seam |
92.98 |
2521.28 |
220.67 |
14.55 |
18.21 |
InPlay |
7.4 |
# Create a summary table
pitch_summary <- detailed_pitch_table %>%
group_by(AutoPitchType) %>%
summarise(
TotalPitches = n(),
Balls = sum(PitchCall == "BallCalled"),
Strikes = sum(PitchCall != "BallCalled"), # Count everything not a ball as a strike
BallPercentage = sprintf("%.2f%%", Balls / TotalPitches * 100),
StrikePercentage = sprintf("%.2f%%", Strikes / TotalPitches * 100),
AvgVelocity = round(mean(ReleaseSpeed, na.rm = TRUE), 2),
AvgSpinRate = round(mean(SpinRate, na.rm = TRUE), 2),
AvgInducedVertBreak = round(mean(InducedVerticalBreak, na.rm = TRUE), 2),
AvgHorzBreak = round(mean(HorizontalBreak, na.rm = TRUE), 2),
AvgTilt = round(mean(Tilt, na.rm = TRUE), 2),
AvgClockTilt = round(mean(ClockTilt, na.rm = TRUE), 1) # Clock face interpretation
)
# Display the summary table
knitr::kable(pitch_summary, caption = "Summary Pitch Table for Falter")
Summary Pitch Table for Falter
Changeup |
6 |
2 |
4 |
33.33% |
66.67% |
85.76 |
1699.58 |
4.46 |
17.47 |
259.97 |
8.7 |
Cutter |
2 |
0 |
2 |
0.00% |
100.00% |
86.61 |
2235.71 |
11.86 |
3.07 |
196.70 |
6.6 |
Four-Seam |
18 |
5 |
13 |
27.78% |
72.22% |
91.35 |
2414.36 |
17.45 |
11.67 |
213.37 |
7.1 |
Sinker |
11 |
4 |
7 |
36.36% |
63.64% |
92.68 |
2283.17 |
13.87 |
18.15 |
235.22 |
7.8 |
Slider |
4 |
2 |
2 |
50.00% |
50.00% |
84.87 |
2272.89 |
8.14 |
2.54 |
203.57 |
6.8 |
# Prepare data for plotting pitch locations
pitch_location_data <- Falter_data %>%
select(AutoPitchType, PlateLocHeight, PlateLocSide, PitchCall) %>%
rename(
PitchHeight = PlateLocHeight,
PitchSide = PlateLocSide
) %>%
mutate(
SwingTake = ifelse(PitchCall %in% c("StrikeSwinging", "FoulBallNonSwinging", "FoulBallFieldable", "FoulBallNotFieldable", "InPlay"), "Swing", "Take"),
Chase = ifelse(SwingTake == "Swing" & (PitchSide < -0.75 | PitchSide > 0.75 | PitchHeight < 1.5 | PitchHeight > 3.5), "Chase", "Non-Chase")
)
# Create the scatter plot with specified strike zone boxes
ggplot(pitch_location_data, aes(x = PitchSide, y = PitchHeight, color = SwingTake, shape = Chase)) +
geom_point(size = 3) + # Increase point size
geom_rect(aes(xmin = -0.5, xmax = 0.5, ymin = 1.75, ymax = 3.25), fill = NA, color = "red", linetype = "solid", size = 1) + # Red box
geom_rect(aes(xmin = -0.75, xmax = 0.75, ymin = 1.5, ymax = 3.5), fill = NA, color = "black", linetype = "solid", size = 1) + # Black box
geom_rect(aes(xmin = -1.25, xmax = 1.25, ymin = 1.25, ymax = 3.75), fill = NA, color = "gray", linetype = "solid", size = 1) + # Gray box
scale_x_continuous(limits = c(-2, 2)) +
scale_y_continuous(limits = c(0, 5)) +
coord_fixed(ratio = 1) + # Adjust ratio to shrink vertical distance
labs(title = "Pitch Locations for Falter",
x = "Horizontal Location (feet)",
y = "Vertical Location (feet)",
color = "Swing/Take",
shape = "Chase") +
facet_wrap(~ AutoPitchType) + # Create individual graphs for each pitch type
geom_text(aes(x = -1.75, y = 5, label = "RHH"), color = "black", size = 3, hjust = 0) + # Label for RHH
geom_text(aes(x = 1.75, y = 5, label = "LHH"), color = "black", size = 3, hjust = 1) + # Label for LHH
theme_minimal() +
theme(
legend.position = "right",
panel.grid.major = element_line(color = "grey80"),
panel.grid.minor = element_line(color = "grey90"),
axis.text = element_text(color = "black"),
axis.title = element_text(color = "black"),
plot.title = element_text(color = "black"),
legend.background = element_rect(fill = "white", color = NA),
legend.key = element_rect(fill = "white", color = NA),
legend.text = element_text(color = "black"),
legend.title = element_text(color = "black")
)

# Create the scatter plot for horizontal and vertical breaks
ggplot(detailed_pitch_table, aes(x = HorizontalBreak, y = InducedVerticalBreak, color = AutoPitchType)) +
geom_point(size = 3) + # Increase point size
labs(title = "Pitch Movement for Falter",
x = "Horizontal Break (inches)",
y = "Induced Vertical Break (inches)",
color = "Pitch Type") +
theme_minimal() +
theme(
legend.position = "right",
panel.grid.major = element_line(color = "grey80"),
panel.grid.minor = element_line(color = "grey90"),
axis.text = element_text(color = "black"),
axis.title = element_text(color = "black"),
plot.title = element_text(color = "black"),
legend.background = element_rect(fill = "white", color = NA),
legend.key = element_rect(fill = "white", color = NA),
legend.text = element_text(color = "black"),
legend.title = element_text(color = "black")
)
