Spaces:
Sleeping
Sleeping
Update app.R
Browse files
app.R
CHANGED
|
@@ -515,13 +515,18 @@ field_graph <- function(player, position, oaa_df) {
|
|
| 515 |
theme_void() +
|
| 516 |
geom_point(data = df_f %>% mutate(is_catch = ifelse(success_ind==1,'Catch',"Hit")),
|
| 517 |
aes(x=z_pos,y=x_pos,fill=is_catch,
|
| 518 |
-
text=paste0("Date: ",Date,
|
|
|
|
|
|
|
|
|
|
| 519 |
"<br>Distance Needed: ",round(closest_pos_dist,1)," ft",
|
| 520 |
"<br>Catch Probability: ",round(100*catch_prob,1),"%<br>",star_group)),
|
| 521 |
color="black",shape=21,size=2,alpha=.6) +
|
| 522 |
labs(title = paste0(player," Possible Catches - ",position)) +
|
| 523 |
scale_fill_manual(values=c("Hit"="white","Catch"="green4"),name=" ") +
|
| 524 |
-
geom_point(data=df_f,aes(x=avg_x,y=avg_y
|
|
|
|
|
|
|
| 525 |
coord_cartesian(xlim=c(-330,330),ylim=c(0,400)) + coord_equal()
|
| 526 |
|
| 527 |
p <- ggplotly(p, tooltip = "text") %>% plotly::layout(hovermode = "closest")
|
|
|
|
| 515 |
theme_void() +
|
| 516 |
geom_point(data = df_f %>% mutate(is_catch = ifelse(success_ind==1,'Catch',"Hit")),
|
| 517 |
aes(x=z_pos,y=x_pos,fill=is_catch,
|
| 518 |
+
text=paste0("Date: ",Date,
|
| 519 |
+
"<br>Opportunity Time: ",round(HangTime,2)," sec",
|
| 520 |
+
"<br>Pitcher: ",Pitcher,
|
| 521 |
+
"<br>Batter: ",Batter,
|
| 522 |
"<br>Distance Needed: ",round(closest_pos_dist,1)," ft",
|
| 523 |
"<br>Catch Probability: ",round(100*catch_prob,1),"%<br>",star_group)),
|
| 524 |
color="black",shape=21,size=2,alpha=.6) +
|
| 525 |
labs(title = paste0(player," Possible Catches - ",position)) +
|
| 526 |
scale_fill_manual(values=c("Hit"="white","Catch"="green4"),name=" ") +
|
| 527 |
+
geom_point(data=df_f,aes(x=avg_x,y=avg_y,
|
| 528 |
+
text=paste0("Avg Position","<br>X: ",round(avg_x,1),"<br>Y: ",round(avg_y,1))),
|
| 529 |
+
fill="red",color="black",size=3,shape=21) +
|
| 530 |
coord_cartesian(xlim=c(-330,330),ylim=c(0,400)) + coord_equal()
|
| 531 |
|
| 532 |
p <- ggplotly(p, tooltip = "text") %>% plotly::layout(hovermode = "closest")
|