@@ -307,16 +307,17 @@ FacetWrap <- ggproto("FacetWrap", Facet,
307307 col_panels <- which(layout $ ROW > first_row & layout $ COL == first_col )
308308 col_pos <- convertInd(layout $ ROW [col_panels ], layout $ COL [col_panels ], nrow )
309309 col_axes <- axes $ y $ right [layout $ SCALE_Y [col_panels ]]
310+ inside <- (theme $ strip.placement %|| % " inside" ) == " inside"
310311 if (params $ strip.position == " bottom" &&
311- theme $ strip.placement != " inside" &&
312+ ! inside &&
312313 any(! vapply(row_axes , is.zero , logical (1 ))) &&
313314 ! params $ free $ x ) {
314315 warning(" Suppressing axis rendering when strip.position = 'bottom' and strip.placement == 'outside'" , call. = FALSE )
315316 } else {
316317 axis_mat_x_bottom [row_pos ] <- row_axes
317318 }
318319 if (params $ strip.position == " right" &&
319- theme $ strip.placement != " inside" &&
320+ ! inside &&
320321 any(! vapply(col_axes , is.zero , logical (1 ))) &&
321322 ! params $ free $ y ) {
322323 warning(" Suppressing axis rendering when strip.position = 'right' and strip.placement == 'outside'" , call. = FALSE )
@@ -334,33 +335,33 @@ FacetWrap <- ggproto("FacetWrap", Facet,
334335 strip_mat <- empty_table
335336 strip_mat [panel_pos ] <- unlist(unname(strips ), recursive = FALSE )[[params $ strip.position ]]
336337 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"
338339 if (params $ strip.position == " top" ) {
339- placement <- if (inside ) - 1 else - 2
340+ placement <- if (inside_x ) - 1 else - 2
340341 strip_pad <- axis_height_top
341342 } else {
342- placement <- if (inside ) 0 else 1
343+ placement <- if (inside_x ) 0 else 1
343344 strip_pad <- axis_height_bottom
344345 }
345346 strip_height <- unit(apply(strip_mat , 1 , max_height , value_only = TRUE ), " cm" )
346347 panel_table <- weave_tables_row(panel_table , strip_mat , placement , strip_height , strip_name , 2 , coord $ clip )
347- if (! inside ) {
348+ if (! inside_x ) {
348349 strip_pad [as.numeric(strip_pad ) != 0 ] <- strip_padding
349350 panel_table <- weave_tables_row(panel_table , row_shift = placement , row_height = strip_pad )
350351 }
351352 } else {
352- inside <- (theme $ strip.placement.y %|| % theme $ strip.placement %|| % " inside" ) == " inside"
353+ inside_y <- (theme $ strip.placement.y %|| % theme $ strip.placement %|| % " inside" ) == " inside"
353354 if (params $ strip.position == " left" ) {
354- placement <- if (inside ) - 1 else - 2
355+ placement <- if (inside_y ) - 1 else - 2
355356 strip_pad <- axis_width_left
356357 } else {
357- placement <- if (inside ) 0 else 1
358+ placement <- if (inside_y ) 0 else 1
358359 strip_pad <- axis_width_right
359360 }
360361 strip_pad [as.numeric(strip_pad ) != 0 ] <- strip_padding
361362 strip_width <- unit(apply(strip_mat , 2 , max_width , value_only = TRUE ), " cm" )
362363 panel_table <- weave_tables_col(panel_table , strip_mat , placement , strip_width , strip_name , 2 , coord $ clip )
363- if (! inside ) {
364+ if (! inside_y ) {
364365 strip_pad [as.numeric(strip_pad ) != 0 ] <- strip_padding
365366 panel_table <- weave_tables_col(panel_table , col_shift = placement , col_width = strip_pad )
366367 }
0 commit comments