@@ -311,7 +311,7 @@ FacetGrid <- ggproto("FacetGrid", Facet,
311311 }
312312
313313 panel_table <- gtable_matrix(" layout" , panel_table ,
314- panel_widths , panel_heights , respect = respect )
314+ panel_widths , panel_heights , respect = respect , clip = " on " )
315315 panel_table $ layout $ name <- paste0(' panel-' , rep(seq_len(ncol ), nrow ), ' -' , rep(seq_len(nrow ), each = ncol ))
316316
317317 panel_table <- gtable_add_col_space(panel_table ,
@@ -327,10 +327,10 @@ FacetGrid <- ggproto("FacetGrid", Facet,
327327 panel_pos_col <- panel_cols(panel_table )
328328 panel_pos_rows <- panel_rows(panel_table )
329329
330- panel_table <- gtable_add_grob(panel_table , axes $ x $ top , 1 , panel_pos_col $ l , clip = " off" , name = paste0(" axis-t-" , seq_along(axes $ x $ top )))
331- panel_table <- gtable_add_grob(panel_table , axes $ x $ bottom , - 1 , panel_pos_col $ l , clip = " off" , name = paste0(" axis-b-" , seq_along(axes $ x $ bottom )))
332- panel_table <- gtable_add_grob(panel_table , axes $ y $ left , panel_pos_rows $ t , 1 , clip = " off" , name = paste0(" axis-l-" , seq_along(axes $ y $ left )))
333- panel_table <- gtable_add_grob(panel_table , axes $ y $ right , panel_pos_rows $ t , - 1 , clip = " off" , name = paste0(" axis-r-" , seq_along(axes $ y $ right )))
330+ panel_table <- gtable_add_grob(panel_table , axes $ x $ top , 1 , panel_pos_col $ l , clip = " off" , name = paste0(" axis-t-" , seq_along(axes $ x $ top )), z = 3 )
331+ panel_table <- gtable_add_grob(panel_table , axes $ x $ bottom , - 1 , panel_pos_col $ l , clip = " off" , name = paste0(" axis-b-" , seq_along(axes $ x $ bottom )), z = 3 )
332+ panel_table <- gtable_add_grob(panel_table , axes $ y $ left , panel_pos_rows $ t , 1 , clip = " off" , name = paste0(" axis-l-" , seq_along(axes $ y $ left )), z = 3 )
333+ panel_table <- gtable_add_grob(panel_table , axes $ y $ right , panel_pos_rows $ t , - 1 , clip = " off" , name = paste0(" axis-r-" , seq_along(axes $ y $ right )), z = 3 )
334334
335335 # Add strips
336336 switch_x <- ! is.null(params $ switch ) && params $ switch %in% c(" both" , " x" )
@@ -343,22 +343,22 @@ FacetGrid <- ggproto("FacetGrid", Facet,
343343 if (! is.null(strips $ x $ bottom )) {
344344 if (inside_x ) {
345345 panel_table <- gtable_add_rows(panel_table , max_height(strips $ x $ bottom ), - 2 )
346- panel_table <- gtable_add_grob(panel_table , strips $ x $ bottom , - 2 , panel_pos_col $ l , clip = " off " , name = paste0(" strip-b-" , seq_along(strips $ x $ bottom )))
346+ panel_table <- gtable_add_grob(panel_table , strips $ x $ bottom , - 2 , panel_pos_col $ l , clip = " on " , name = paste0(" strip-b-" , seq_along(strips $ x $ bottom )), z = 2 )
347347 } else {
348348 panel_table <- gtable_add_rows(panel_table , strip_padding , - 1 )
349349 panel_table <- gtable_add_rows(panel_table , max_height(strips $ x $ bottom ), - 1 )
350- panel_table <- gtable_add_grob(panel_table , strips $ x $ bottom , - 1 , panel_pos_col $ l , clip = " off " , name = paste0(" strip-b-" , seq_along(strips $ x $ bottom )))
350+ panel_table <- gtable_add_grob(panel_table , strips $ x $ bottom , - 1 , panel_pos_col $ l , clip = " on " , name = paste0(" strip-b-" , seq_along(strips $ x $ bottom )), z = 2 )
351351 }
352352 }
353353 } else {
354354 if (! is.null(strips $ x $ top )) {
355355 if (inside_x ) {
356356 panel_table <- gtable_add_rows(panel_table , max_height(strips $ x $ top ), 1 )
357- panel_table <- gtable_add_grob(panel_table , strips $ x $ top , 2 , panel_pos_col $ l , clip = " off " , name = paste0(" strip-t-" , seq_along(strips $ x $ top )))
357+ panel_table <- gtable_add_grob(panel_table , strips $ x $ top , 2 , panel_pos_col $ l , clip = " on " , name = paste0(" strip-t-" , seq_along(strips $ x $ top )), z = 2 )
358358 } else {
359359 panel_table <- gtable_add_rows(panel_table , strip_padding , 0 )
360360 panel_table <- gtable_add_rows(panel_table , max_height(strips $ x $ top ), 0 )
361- panel_table <- gtable_add_grob(panel_table , strips $ x $ top , 1 , panel_pos_col $ l , clip = " off " , name = paste0(" strip-t-" , seq_along(strips $ x $ top )))
361+ panel_table <- gtable_add_grob(panel_table , strips $ x $ top , 1 , panel_pos_col $ l , clip = " on " , name = paste0(" strip-t-" , seq_along(strips $ x $ top )), z = 2 )
362362 }
363363 }
364364 }
@@ -367,22 +367,22 @@ FacetGrid <- ggproto("FacetGrid", Facet,
367367 if (! is.null(strips $ y $ left )) {
368368 if (inside_y ) {
369369 panel_table <- gtable_add_cols(panel_table , max_width(strips $ y $ left ), 1 )
370- panel_table <- gtable_add_grob(panel_table , strips $ y $ left , panel_pos_rows $ t , 2 , clip = " off " , name = paste0(" strip-l-" , seq_along(strips $ y $ left )))
370+ panel_table <- gtable_add_grob(panel_table , strips $ y $ left , panel_pos_rows $ t , 2 , clip = " on " , name = paste0(" strip-l-" , seq_along(strips $ y $ left )), z = 2 )
371371 } else {
372372 panel_table <- gtable_add_cols(panel_table , strip_padding , 0 )
373373 panel_table <- gtable_add_cols(panel_table , max_width(strips $ y $ left ), 0 )
374- panel_table <- gtable_add_grob(panel_table , strips $ y $ left , panel_pos_rows $ t , 1 , clip = " off " , name = paste0(" strip-l-" , seq_along(strips $ y $ left )))
374+ panel_table <- gtable_add_grob(panel_table , strips $ y $ left , panel_pos_rows $ t , 1 , clip = " on " , name = paste0(" strip-l-" , seq_along(strips $ y $ left )), z = 2 )
375375 }
376376 }
377377 } else {
378378 if (! is.null(strips $ y $ right )) {
379379 if (inside_y ) {
380380 panel_table <- gtable_add_cols(panel_table , max_width(strips $ y $ right ), - 2 )
381- panel_table <- gtable_add_grob(panel_table , strips $ y $ right , panel_pos_rows $ t , - 2 , clip = " off " , name = paste0(" strip-r-" , seq_along(strips $ y $ right )))
381+ panel_table <- gtable_add_grob(panel_table , strips $ y $ right , panel_pos_rows $ t , - 2 , clip = " on " , name = paste0(" strip-r-" , seq_along(strips $ y $ right )), z = 2 )
382382 } else {
383383 panel_table <- gtable_add_cols(panel_table , strip_padding , - 1 )
384384 panel_table <- gtable_add_cols(panel_table , max_width(strips $ y $ right ), - 1 )
385- panel_table <- gtable_add_grob(panel_table , strips $ y $ right , panel_pos_rows $ t , - 1 , clip = " off " , name = paste0(" strip-r-" , seq_along(strips $ y $ right )))
385+ panel_table <- gtable_add_grob(panel_table , strips $ y $ right , panel_pos_rows $ t , - 1 , clip = " on " , name = paste0(" strip-r-" , seq_along(strips $ y $ right )), z = 2 )
386386 }
387387 }
388388 }
0 commit comments