@@ -281,10 +281,22 @@ FacetWrap <- ggproto("FacetWrap", Facet,
281
281
axis_mat_y_left [, - 1 ] <- list (zeroGrob())
282
282
axis_mat_y_right [, - ncol ] <- list (zeroGrob())
283
283
}
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
+ )
288
300
# Add back missing axes
289
301
if (any(empties )) {
290
302
first_row <- which(apply(empties , 1 , any ))[1 ] - 1
@@ -330,10 +342,10 @@ FacetWrap <- ggproto("FacetWrap", Facet,
330
342
placement <- if (inside ) 0 else 1
331
343
strip_pad <- axis_height_bottom
332
344
}
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" )
334
346
panel_table <- weave_tables_row(panel_table , strip_mat , placement , strip_height , strip_name , 2 , coord $ clip )
335
347
if (! inside ) {
336
- strip_pad [unclass (strip_pad ) != 0 ] <- strip_padding
348
+ strip_pad [as.numeric (strip_pad ) != 0 ] <- strip_padding
337
349
panel_table <- weave_tables_row(panel_table , row_shift = placement , row_height = strip_pad )
338
350
}
339
351
} else {
@@ -345,11 +357,11 @@ FacetWrap <- ggproto("FacetWrap", Facet,
345
357
placement <- if (inside ) 0 else 1
346
358
strip_pad <- axis_width_right
347
359
}
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" )
350
362
panel_table <- weave_tables_col(panel_table , strip_mat , placement , strip_width , strip_name , 2 , coord $ clip )
351
363
if (! inside ) {
352
- strip_pad [unclass (strip_pad ) != 0 ] <- strip_padding
364
+ strip_pad [as.numeric (strip_pad ) != 0 ] <- strip_padding
353
365
panel_table <- weave_tables_col(panel_table , col_shift = placement , col_width = strip_pad )
354
366
}
355
367
}
0 commit comments