Spaces:
Sleeping
Sleeping
Update app.R
Browse files
app.R
CHANGED
|
@@ -107,16 +107,16 @@ break_plot <- function(game){
|
|
| 107 |
"Slider"= "#0074D9",
|
| 108 |
"Sweeper"= "#ED68ED",
|
| 109 |
"Curveball"= "#B10DC9",
|
| 110 |
-
"Splitter"= "#
|
| 111 |
"Knuckle Curve"= "#85144b",
|
| 112 |
"Slurve"= "#3D9970",
|
| 113 |
"Knuckle Ball"= "#39CCCC",
|
| 114 |
-
"Forkball"= "#
|
| 115 |
"Eephus"= "#AAAAAA",
|
| 116 |
"Fastball"= "#7FDBFF",
|
| 117 |
"Slow Curve"= "#DDDDDD",
|
| 118 |
"Screwball"= "#FF69B4"
|
| 119 |
-
|
| 120 |
ggplot(game, aes(x = HB, y = IVB, color = pitch_name)) +
|
| 121 |
geom_point(size = 2) +
|
| 122 |
geom_vline(xintercept = 0, color = "lightblue", linewidth = 1, linetype = 4) +
|
|
@@ -149,16 +149,16 @@ pitch_plot <- function(game, title, bhand = NULL) {
|
|
| 149 |
"Slider"= "#0074D9",
|
| 150 |
"Sweeper"= "#ED68ED",
|
| 151 |
"Curveball"= "#B10DC9",
|
| 152 |
-
"Splitter"= "#
|
| 153 |
"Knuckle Curve"= "#85144b",
|
| 154 |
"Slurve"= "#3D9970",
|
| 155 |
"Knuckle Ball"= "#39CCCC",
|
| 156 |
-
"Forkball"= "#
|
| 157 |
"Eephus"= "#AAAAAA",
|
| 158 |
"Fastball"= "#7FDBFF",
|
| 159 |
"Slow Curve"= "#DDDDDD",
|
| 160 |
"Screwball"= "#FF69B4"
|
| 161 |
-
|
| 162 |
ggplot(game, aes(x = px, y = pz, color = pitch_name)) +
|
| 163 |
geom_point(size = 3.5) +
|
| 164 |
geom_segment(aes(x = -0.71, xend = 0.71, y = 1.5, yend = 1.5)) +
|
|
@@ -248,17 +248,16 @@ pitch_colors <- c(
|
|
| 248 |
"Slider"= "#0074D9",
|
| 249 |
"Sweeper"= "#ED68ED",
|
| 250 |
"Curveball"= "#B10DC9",
|
| 251 |
-
"Splitter"= "#
|
| 252 |
"Knuckle Curve"= "#85144b",
|
| 253 |
"Slurve"= "#3D9970",
|
| 254 |
"Knuckle Ball"= "#39CCCC",
|
| 255 |
-
"Forkball"= "#
|
| 256 |
"Eephus"= "#AAAAAA",
|
| 257 |
"Fastball"= "#7FDBFF",
|
| 258 |
"Slow Curve"= "#DDDDDD",
|
| 259 |
"Screwball"= "#FF69B4"
|
| 260 |
-
)
|
| 261 |
-
|
| 262 |
plot_lhb <- ggplot(game_lhb, aes(x = px, y = pz, color = pitch_name)) +
|
| 263 |
geom_point(size = 3) +
|
| 264 |
geom_segment(aes(x = -0.71, xend = 0.71, y = 1.5, yend = 1.5)) +
|
|
@@ -439,7 +438,7 @@ ui <- fluidPage(
|
|
| 439 |
sidebarLayout(
|
| 440 |
sidebarPanel(
|
| 441 |
width = 3,
|
| 442 |
-
dateInput("date", "Date:"
|
| 443 |
selectizeInput("level", "Level:",
|
| 444 |
c("MLB", "AAA", "FSL", "College (Statcast Parks Only)"),
|
| 445 |
options = list(
|
|
@@ -622,23 +621,23 @@ server <- function(input, output, session) {
|
|
| 622 |
}
|
| 623 |
|
| 624 |
pitch_colors <- c(
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
# Create the rolling TimStuff+ graph
|
| 643 |
rolling_data <- rolling_timstuff()
|
| 644 |
timstuff_plot <- ggplot(rolling_data, aes(x = pitch_number, y = rolling_timstuff, color = pitch_name)) +
|
|
|
|
| 107 |
"Slider"= "#0074D9",
|
| 108 |
"Sweeper"= "#ED68ED",
|
| 109 |
"Curveball"= "#B10DC9",
|
| 110 |
+
"Splitter"= "#01FF70",
|
| 111 |
"Knuckle Curve"= "#85144b",
|
| 112 |
"Slurve"= "#3D9970",
|
| 113 |
"Knuckle Ball"= "#39CCCC",
|
| 114 |
+
"Forkball"= "#F012BE",
|
| 115 |
"Eephus"= "#AAAAAA",
|
| 116 |
"Fastball"= "#7FDBFF",
|
| 117 |
"Slow Curve"= "#DDDDDD",
|
| 118 |
"Screwball"= "#FF69B4"
|
| 119 |
+
)
|
| 120 |
ggplot(game, aes(x = HB, y = IVB, color = pitch_name)) +
|
| 121 |
geom_point(size = 2) +
|
| 122 |
geom_vline(xintercept = 0, color = "lightblue", linewidth = 1, linetype = 4) +
|
|
|
|
| 149 |
"Slider"= "#0074D9",
|
| 150 |
"Sweeper"= "#ED68ED",
|
| 151 |
"Curveball"= "#B10DC9",
|
| 152 |
+
"Splitter"= "#01FF70",
|
| 153 |
"Knuckle Curve"= "#85144b",
|
| 154 |
"Slurve"= "#3D9970",
|
| 155 |
"Knuckle Ball"= "#39CCCC",
|
| 156 |
+
"Forkball"= "#F012BE",
|
| 157 |
"Eephus"= "#AAAAAA",
|
| 158 |
"Fastball"= "#7FDBFF",
|
| 159 |
"Slow Curve"= "#DDDDDD",
|
| 160 |
"Screwball"= "#FF69B4"
|
| 161 |
+
)
|
| 162 |
ggplot(game, aes(x = px, y = pz, color = pitch_name)) +
|
| 163 |
geom_point(size = 3.5) +
|
| 164 |
geom_segment(aes(x = -0.71, xend = 0.71, y = 1.5, yend = 1.5)) +
|
|
|
|
| 248 |
"Slider"= "#0074D9",
|
| 249 |
"Sweeper"= "#ED68ED",
|
| 250 |
"Curveball"= "#B10DC9",
|
| 251 |
+
"Splitter"= "#01FF70",
|
| 252 |
"Knuckle Curve"= "#85144b",
|
| 253 |
"Slurve"= "#3D9970",
|
| 254 |
"Knuckle Ball"= "#39CCCC",
|
| 255 |
+
"Forkball"= "#F012BE",
|
| 256 |
"Eephus"= "#AAAAAA",
|
| 257 |
"Fastball"= "#7FDBFF",
|
| 258 |
"Slow Curve"= "#DDDDDD",
|
| 259 |
"Screwball"= "#FF69B4"
|
| 260 |
+
)
|
|
|
|
| 261 |
plot_lhb <- ggplot(game_lhb, aes(x = px, y = pz, color = pitch_name)) +
|
| 262 |
geom_point(size = 3) +
|
| 263 |
geom_segment(aes(x = -0.71, xend = 0.71, y = 1.5, yend = 1.5)) +
|
|
|
|
| 438 |
sidebarLayout(
|
| 439 |
sidebarPanel(
|
| 440 |
width = 3,
|
| 441 |
+
dateInput("date", "Date:"),
|
| 442 |
selectizeInput("level", "Level:",
|
| 443 |
c("MLB", "AAA", "FSL", "College (Statcast Parks Only)"),
|
| 444 |
options = list(
|
|
|
|
| 621 |
}
|
| 622 |
|
| 623 |
pitch_colors <- c(
|
| 624 |
+
"Four-Seam Fastball"= "#FF4136",
|
| 625 |
+
"Sinker"= "#FF851B",
|
| 626 |
+
"Cutter"= "#FFDC00",
|
| 627 |
+
"Changeup"= "#2ECC40",
|
| 628 |
+
"Slider"= "#0074D9",
|
| 629 |
+
"Sweeper"= "#ED68ED",
|
| 630 |
+
"Curveball"= "#B10DC9",
|
| 631 |
+
"Splitter"= "#01FF70",
|
| 632 |
+
"Knuckle Curve"= "#85144b",
|
| 633 |
+
"Slurve"= "#3D9970",
|
| 634 |
+
"Knuckle Ball"= "#39CCCC",
|
| 635 |
+
"Forkball"= "#F012BE",
|
| 636 |
+
"Eephus"= "#AAAAAA",
|
| 637 |
+
"Fastball"= "#7FDBFF",
|
| 638 |
+
"Slow Curve"= "#DDDDDD",
|
| 639 |
+
"Screwball"= "#FF69B4"
|
| 640 |
+
)
|
| 641 |
# Create the rolling TimStuff+ graph
|
| 642 |
rolling_data <- rolling_timstuff()
|
| 643 |
timstuff_plot <- ggplot(rolling_data, aes(x = pitch_number, y = rolling_timstuff, color = pitch_name)) +
|