@@ -281,10 +281,22 @@ FacetWrap <- ggproto("FacetWrap", Facet,
281281 axis_mat_y_left [, - 1 ] <- list (zeroGrob())
282282 axis_mat_y_right [, - ncol ] <- list (zeroGrob())
283283 }
284- axis_height_top <- unit(apply(axis_mat_x_top , 1 , max_height ), " cm" )
285- axis_height_bottom <- unit(apply(axis_mat_x_bottom , 1 , max_height ), " cm" )
286- axis_width_left <- unit(apply(axis_mat_y_left , 2 , max_width ), " cm" )
287- axis_width_right <- unit(apply(axis_mat_y_right , 2 , max_width ), " cm" )
284+ axis_height_top <- unit(
285+ apply(axis_mat_x_top , 1 , max_height , value_only = TRUE ),
286+ " cm"
287+ )
288+ axis_height_bottom <- unit(
289+ apply(axis_mat_x_bottom , 1 , max_height , value_only = TRUE ),
290+ " cm"
291+ )
292+ axis_width_left <- unit(
293+ apply(axis_mat_y_left , 2 , max_width , value_only = TRUE ),
294+ " cm"
295+ )
296+ axis_width_right <- unit(
297+ apply(axis_mat_y_right , 2 , max_width , value_only = TRUE ),
298+ " cm"
299+ )
288300 # Add back missing axes
289301 if (any(empties )) {
290302 first_row <- which(apply(empties , 1 , any ))[1 ] - 1
@@ -330,10 +342,10 @@ FacetWrap <- ggproto("FacetWrap", Facet,
330342 placement <- if (inside ) 0 else 1
331343 strip_pad <- axis_height_bottom
332344 }
333- strip_height <- unit(apply(strip_mat , 1 , max_height ), " cm" )
345+ strip_height <- unit(apply(strip_mat , 1 , max_height , value_only = TRUE ), " cm" )
334346 panel_table <- weave_tables_row(panel_table , strip_mat , placement , strip_height , strip_name , 2 , coord $ clip )
335347 if (! inside ) {
336- strip_pad [unclass (strip_pad ) != 0 ] <- strip_padding
348+ strip_pad [as.numeric (strip_pad ) != 0 ] <- strip_padding
337349 panel_table <- weave_tables_row(panel_table , row_shift = placement , row_height = strip_pad )
338350 }
339351 } else {
@@ -345,11 +357,11 @@ FacetWrap <- ggproto("FacetWrap", Facet,
345357 placement <- if (inside ) 0 else 1
346358 strip_pad <- axis_width_right
347359 }
348- strip_pad [unclass (strip_pad ) != 0 ] <- strip_padding
349- strip_width <- unit(apply(strip_mat , 2 , max_width ), " cm" )
360+ strip_pad [as.numeric (strip_pad ) != 0 ] <- strip_padding
361+ strip_width <- unit(apply(strip_mat , 2 , max_width , value_only = TRUE ), " cm" )
350362 panel_table <- weave_tables_col(panel_table , strip_mat , placement , strip_width , strip_name , 2 , coord $ clip )
351363 if (! inside ) {
352- strip_pad [unclass (strip_pad ) != 0 ] <- strip_padding
364+ strip_pad [as.numeric (strip_pad ) != 0 ] <- strip_padding
353365 panel_table <- weave_tables_col(panel_table , col_shift = placement , col_width = strip_pad )
354366 }
355367 }
0 commit comments