@@ -307,16 +307,17 @@ FacetWrap <- ggproto("FacetWrap", Facet,
307
307
col_panels <- which(layout $ ROW > first_row & layout $ COL == first_col )
308
308
col_pos <- convertInd(layout $ ROW [col_panels ], layout $ COL [col_panels ], nrow )
309
309
col_axes <- axes $ y $ right [layout $ SCALE_Y [col_panels ]]
310
+ inside <- (theme $ strip.placement %|| % " inside" ) == " inside"
310
311
if (params $ strip.position == " bottom" &&
311
- theme $ strip.placement != " inside" &&
312
+ ! inside &&
312
313
any(! vapply(row_axes , is.zero , logical (1 ))) &&
313
314
! params $ free $ x ) {
314
315
warning(" Suppressing axis rendering when strip.position = 'bottom' and strip.placement == 'outside'" , call. = FALSE )
315
316
} else {
316
317
axis_mat_x_bottom [row_pos ] <- row_axes
317
318
}
318
319
if (params $ strip.position == " right" &&
319
- theme $ strip.placement != " inside" &&
320
+ ! inside &&
320
321
any(! vapply(col_axes , is.zero , logical (1 ))) &&
321
322
! params $ free $ y ) {
322
323
warning(" Suppressing axis rendering when strip.position = 'right' and strip.placement == 'outside'" , call. = FALSE )
@@ -334,33 +335,33 @@ FacetWrap <- ggproto("FacetWrap", Facet,
334
335
strip_mat <- empty_table
335
336
strip_mat [panel_pos ] <- unlist(unname(strips ), recursive = FALSE )[[params $ strip.position ]]
336
337
if (params $ strip.position %in% c(" top" , " bottom" )) {
337
- inside <- (theme $ strip.placement.x %|| % theme $ strip.placement %|| % " inside" ) == " inside"
338
+ inside_x <- (theme $ strip.placement.x %|| % theme $ strip.placement %|| % " inside" ) == " inside"
338
339
if (params $ strip.position == " top" ) {
339
- placement <- if (inside ) - 1 else - 2
340
+ placement <- if (inside_x ) - 1 else - 2
340
341
strip_pad <- axis_height_top
341
342
} else {
342
- placement <- if (inside ) 0 else 1
343
+ placement <- if (inside_x ) 0 else 1
343
344
strip_pad <- axis_height_bottom
344
345
}
345
346
strip_height <- unit(apply(strip_mat , 1 , max_height , value_only = TRUE ), " cm" )
346
347
panel_table <- weave_tables_row(panel_table , strip_mat , placement , strip_height , strip_name , 2 , coord $ clip )
347
- if (! inside ) {
348
+ if (! inside_x ) {
348
349
strip_pad [as.numeric(strip_pad ) != 0 ] <- strip_padding
349
350
panel_table <- weave_tables_row(panel_table , row_shift = placement , row_height = strip_pad )
350
351
}
351
352
} else {
352
- inside <- (theme $ strip.placement.y %|| % theme $ strip.placement %|| % " inside" ) == " inside"
353
+ inside_y <- (theme $ strip.placement.y %|| % theme $ strip.placement %|| % " inside" ) == " inside"
353
354
if (params $ strip.position == " left" ) {
354
- placement <- if (inside ) - 1 else - 2
355
+ placement <- if (inside_y ) - 1 else - 2
355
356
strip_pad <- axis_width_left
356
357
} else {
357
- placement <- if (inside ) 0 else 1
358
+ placement <- if (inside_y ) 0 else 1
358
359
strip_pad <- axis_width_right
359
360
}
360
361
strip_pad [as.numeric(strip_pad ) != 0 ] <- strip_padding
361
362
strip_width <- unit(apply(strip_mat , 2 , max_width , value_only = TRUE ), " cm" )
362
363
panel_table <- weave_tables_col(panel_table , strip_mat , placement , strip_width , strip_name , 2 , coord $ clip )
363
- if (! inside ) {
364
+ if (! inside_y ) {
364
365
strip_pad [as.numeric(strip_pad ) != 0 ] <- strip_padding
365
366
panel_table <- weave_tables_col(panel_table , col_shift = placement , col_width = strip_pad )
366
367
}
0 commit comments