igroffman commited on
Commit
cbd1064
·
verified ·
1 Parent(s): b90d3b5

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +22 -22
app.R CHANGED
@@ -3318,20 +3318,25 @@ create_advanced_pitcher_pdf <- function(game_df, pitcher_name, output_file, logo
3318
  on.exit(try(dev.off(), silent = TRUE), add = TRUE)
3319
  grid::grid.newpage()
3320
 
3321
- # Layout calculations
3322
  header_y_top <- 0.98
3323
  charts_y_top <- 0.85
3324
  charts_height <- 0.30
3325
  charts_y_bottom <- charts_y_top - charts_height
3326
- count_y_top <- charts_y_bottom - 0.02
3327
- count_height <- 0.18
3328
- count_y_bottom <- count_y_top - count_height
3329
- base_loc_top <- 0.30
3330
- table_margin <- 0.03
3331
- min_row_h <- 0.0125
3332
- max_row_h <- 0.0180
3333
-
3334
- y_top_char_orig <- count_y_bottom - 0.011
 
 
 
 
 
 
3335
  rows_including_header <- num_rows + 1
3336
  available_for_table_orig <- y_top_char_orig - (base_loc_top + table_margin)
3337
  row_h_char <- min(max_row_h, max(min_row_h, available_for_table_orig / max(1, rows_including_header)))
@@ -3405,18 +3410,13 @@ create_advanced_pitcher_pdf <- function(game_df, pitcher_name, output_file, logo
3405
  tryCatch(print(count_plot, newpage = FALSE), error = function(e) NULL)
3406
  grid::popViewport()
3407
 
3408
- # ENLARGED Release side plot on right - increased width and height
3409
- grid::pushViewport(
3410
- viewport(
3411
- x = 0.5,
3412
- y = 0.35, # move it down slightly
3413
- width = unit(0.55, "npc"),
3414
- height = unit(0.25, "npc"), # ← INCREASE HEIGHT (was around 0.15–0.18)
3415
- just = "center"
3416
- )
3417
- )
3418
- tryCatch(print(relside_height_plot, newpage = FALSE), error = function(e) NULL)
3419
- popViewport()
3420
 
3421
  # Pitch Characteristics table
3422
  grid::grid.text("Pitch Characteristics", x = 0.5, y = y_top_char + 0.015,
 
3318
  on.exit(try(dev.off(), silent = TRUE), add = TRUE)
3319
  grid::grid.newpage()
3320
 
 
3321
  header_y_top <- 0.98
3322
  charts_y_top <- 0.85
3323
  charts_height <- 0.30
3324
  charts_y_bottom <- charts_y_top - charts_height
3325
+
3326
+ # Row 2 (Count + Release)
3327
+ count_y_top <- charts_y_bottom - 0.02
3328
+ count_height <- 0.18 # keep count usage height
3329
+ release_height <- 0.24 # make release plot TALLER than count
3330
+ row2_bottom <- count_y_top - max(count_height, release_height)
3331
+ count_y_bottom <- count_y_top - count_height
3332
+
3333
+ base_loc_top <- 0.30
3334
+ table_margin <- 0.03
3335
+ min_row_h <- 0.0125
3336
+ max_row_h <- 0.0180
3337
+
3338
+ # Pitch characteristics table starts just below row 2
3339
+ y_top_char_orig <- row2_bottom - 0.011
3340
  rows_including_header <- num_rows + 1
3341
  available_for_table_orig <- y_top_char_orig - (base_loc_top + table_margin)
3342
  row_h_char <- min(max_row_h, max(min_row_h, available_for_table_orig / max(1, rows_including_header)))
 
3410
  tryCatch(print(count_plot, newpage = FALSE), error = function(e) NULL)
3411
  grid::popViewport()
3412
 
3413
+ grid::pushViewport(grid::viewport(
3414
+ x = 0.77, y = count_y_top,
3415
+ width = 0.44, height = release_height, # ← use release_height here
3416
+ just = c("center","top")
3417
+ ))
3418
+ tryCatch(print(relside_height_plot, newpage = FALSE), error = function(e) NULL)
3419
+ grid::popViewport()
 
 
 
 
 
3420
 
3421
  # Pitch Characteristics table
3422
  grid::grid.text("Pitch Characteristics", x = 0.5, y = y_top_char + 0.015,