Spaces:
Build error
Build error
Update app.R
Browse files
app.R
CHANGED
|
@@ -64,14 +64,19 @@ break_plot_Szn <- function(game,data1,sdate,edate) {
|
|
| 64 |
angle_radians <- angle_degrees * (pi / 180)
|
| 65 |
|
| 66 |
# Legend location based on handedness
|
| 67 |
-
|
| 68 |
leg <- c(0.08, .22)
|
| 69 |
factor <- -1
|
|
|
|
|
|
|
|
|
|
| 70 |
} else {
|
| 71 |
leg <- c(0.92, .22)
|
| 72 |
factor <- 1
|
|
|
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
-
|
| 75 |
# Calculate the endpoint coordinates
|
| 76 |
x_end <- 50 * cos(angle_radians) * factor
|
| 77 |
y_end <- 50 * sin(angle_radians)
|
|
@@ -323,9 +328,9 @@ ui <- fluidPage(
|
|
| 323 |
width = 3,
|
| 324 |
selectInput("player", "Select Player:", choices = unique(data1$`Pitcher Name`),
|
| 325 |
width = "100%"),
|
| 326 |
-
dateRangeInput("date1", "Dates: (Be wary of multi year plots as arm angles may
|
| 327 |
-
start = "2024-
|
| 328 |
-
end = "2024-
|
| 329 |
width = "100%"),
|
| 330 |
radioButtons("type", "Plot Type",
|
| 331 |
choices = c("Season Average","All Pitches")),
|
|
|
|
| 64 |
angle_radians <- angle_degrees * (pi / 180)
|
| 65 |
|
| 66 |
# Legend location based on handedness
|
| 67 |
+
if(pitcher_hand == "L") {
|
| 68 |
leg <- c(0.08, .22)
|
| 69 |
factor <- -1
|
| 70 |
+
if(angle_degrees < 0){
|
| 71 |
+
leg <- c(0.92, .22)
|
| 72 |
+
}
|
| 73 |
} else {
|
| 74 |
leg <- c(0.92, .22)
|
| 75 |
factor <- 1
|
| 76 |
+
if(angle_degrees < 0){
|
| 77 |
+
leg <- c(0.08, .22)
|
| 78 |
+
}
|
| 79 |
}
|
|
|
|
| 80 |
# Calculate the endpoint coordinates
|
| 81 |
x_end <- 50 * cos(angle_radians) * factor
|
| 82 |
y_end <- 50 * sin(angle_radians)
|
|
|
|
| 328 |
width = 3,
|
| 329 |
selectInput("player", "Select Player:", choices = unique(data1$`Pitcher Name`),
|
| 330 |
width = "100%"),
|
| 331 |
+
dateRangeInput("date1", "Dates: (Be wary of multi year plots as arm angles may vary over years)",
|
| 332 |
+
start = "2024-03-20",
|
| 333 |
+
end = "2024-10-01",
|
| 334 |
width = "100%"),
|
| 335 |
radioButtons("type", "Plot Type",
|
| 336 |
choices = c("Season Average","All Pitches")),
|