12
12
# ' @param label a character or numeric column in the `data` data frame that contains values that should be plotted as labels
13
13
# ' on the plate layout. Can be the same column as `value`.
14
14
# ' @param plate_size a numeric value that specifies the plate size (number of wells) used for the plot. Possible values
15
- # ' are: 6, 12, 24, 48, 96 and 384 .
15
+ # ' are: 6, 12, 24, 48, 96, 384 and 1536 .
16
16
# ' @param plate_type a character value that specifies the well type. Possible values are "round" and "square". The default is
17
17
# ' "square".
18
18
# ' @param colour optional, a character vector that contains colours used for the plot. If the `value` argument is discrete
@@ -127,7 +127,7 @@ plate_plot <- function(data,
127
127
label_size ,
128
128
silent = TRUE ,
129
129
scale ) {
130
- if (! plate_size %in% c(6 , 12 , 24 , 48 , 96 , 384 )) {
130
+ if (! plate_size %in% c(6 , 12 , 24 , 48 , 96 , 384 , 1536 )) {
131
131
stop(" Selected plate_size not available!" )
132
132
}
133
133
@@ -223,15 +223,17 @@ plate_plot <- function(data,
223
223
nchar() | >
224
224
max()
225
225
226
+ MORELETTERS <- c(LETTERS , " AA" , " AB" , " AC" , " AD" , " AE" , " AF" )
227
+
226
228
data_prep <- data | >
227
229
dplyr :: ungroup() | >
228
230
dplyr :: mutate(
229
231
row = stringr :: str_extract({{ position }}, pattern = " [:upper:]+" ),
230
232
col = as.numeric(stringr :: str_extract({{ position }}, pattern = " \\ d+" )),
231
- row_num = as.numeric(match(.data $ row , LETTERS )),
233
+ row_num = as.numeric(match(.data $ row , MORELETTERS )),
232
234
colours = data_colours ,
233
235
label_colours = label_col
234
- )
236
+ )
235
237
236
238
if (! is.numeric(dplyr :: pull(data , {{ value }}))) {
237
239
# Convert character values to factors
@@ -413,7 +415,26 @@ plate_plot <- function(data,
413
415
size <- (4.4 - max((max_label_length - 13 ) * 0.07 , 0 )) * scale
414
416
}
415
417
}
416
-
418
+
419
+ if (plate_size == 1536 ) {
420
+ n_cols <- 48
421
+ n_rows <- 32
422
+ size <- 1.8 * scale
423
+ min_x_axis <- 0.95
424
+ max_x_axis <- n_cols
425
+ min_y_axis <- 0.9
426
+ max_y_axis <- n_rows
427
+ text_size <- 4 * scale
428
+ legend_text_size <- text_size
429
+ legend_title_size <- text_size
430
+ title_size_preset <- 10 * scale
431
+ legend_size <- size
432
+ stroke_width <- 0.3 * scale
433
+ if (show_legend ) {
434
+ size <- (2.2 - max((max_label_length - 13 ) * 0.07 , 0 )) * scale
435
+ }
436
+ }
437
+
417
438
# Update row number to be reversed
418
439
# This depends on the n_rows variable, which depends on the plate size
419
440
data_prep <- data_prep | >
@@ -465,7 +486,7 @@ plate_plot <- function(data,
465
486
xlim = c(min_x_axis , max_x_axis ),
466
487
ylim = c(min_y_axis , max_y_axis )
467
488
) +
468
- ggplot2 :: scale_y_continuous(breaks = seq(1 , n_rows ), labels = rev(LETTERS [1 : n_rows ])) +
489
+ ggplot2 :: scale_y_continuous(breaks = seq(1 , n_rows ), labels = rev(MORELETTERS [1 : n_rows ])) +
469
490
ggplot2 :: scale_x_continuous(breaks = seq(1 , n_cols ), position = " top" ) +
470
491
{
471
492
if (is.numeric(dplyr :: pull(data , {{ value }}))) {
@@ -485,15 +506,15 @@ plate_plot <- function(data,
485
506
y = " "
486
507
) +
487
508
{
488
- if (! missing(label )) ggplot2 :: geom_text(ggplot2 :: aes(x = col ,
489
- y = .data $ row_num ,
509
+ if (! missing(label )) ggplot2 :: geom_text(ggplot2 :: aes(x = col ,
510
+ y = .data $ row_num ,
490
511
label = format(
491
- {{ label }},
512
+ {{ label }},
492
513
drop0Trailing = FALSE , # does not drop trailing 0
493
514
justify = " none" , # does not add white spaces for justification
494
515
trim = TRUE ) # removes leading white spaces
495
- ),
496
- colour = data_prep $ label_colours ,
516
+ ),
517
+ colour = data_prep $ label_colours ,
497
518
size = label_size_scaled )
498
519
} +
499
520
ggplot2 :: theme_bw() +
0 commit comments