@@ -292,42 +292,42 @@ ggplot_gtable.ggplot_built <- function(data) {
292
292
r = ncol(plot_table ), clip = " off" )
293
293
} else {
294
294
if (tag_pos == " topleft" ) {
295
- plot_table $ widths [ 1 ] <- tag_width
296
- plot_table $ heights [ 1 ] <- tag_height
295
+ plot_table $ widths <- unit.c( tag_width , plot_table $ widths [ - 1 ])
296
+ plot_table $ heights <- unit.c( tag_height , plot_table $ heights [ - 1 ])
297
297
plot_table <- gtable_add_grob(plot_table , tag , name = " tag" ,
298
298
t = 1 , l = 1 , clip = " off" )
299
299
} else if (tag_pos == " top" ) {
300
- plot_table $ heights [ 1 ] <- tag_height
300
+ plot_table $ heights <- unit.c( tag_height , plot_table $ heights [ - 1 ])
301
301
plot_table <- gtable_add_grob(plot_table , tag , name = " tag" ,
302
302
t = 1 , l = 1 , r = ncol(plot_table ),
303
303
clip = " off" )
304
304
} else if (tag_pos == " topright" ) {
305
- plot_table $ widths [ ncol(plot_table )] <- tag_width
306
- plot_table $ heights [ 1 ] <- tag_height
305
+ plot_table $ widths <- unit.c( plot_table $ widths [ - ncol(plot_table )], tag_width )
306
+ plot_table $ heights <- unit.c( tag_height , plot_table $ heights [ - 1 ])
307
307
plot_table <- gtable_add_grob(plot_table , tag , name = " tag" ,
308
308
t = 1 , l = ncol(plot_table ), clip = " off" )
309
309
} else if (tag_pos == " left" ) {
310
- plot_table $ widths [ 1 ] <- tag_width
310
+ plot_table $ widths <- unit.c( tag_width , plot_table $ widths [ - 1 ])
311
311
plot_table <- gtable_add_grob(plot_table , tag , name = " tag" ,
312
312
t = 1 , b = nrow(plot_table ), l = 1 ,
313
313
clip = " off" )
314
314
} else if (tag_pos == " right" ) {
315
- plot_table $ widths [ ncol(plot_table )] <- tag_width
315
+ plot_table $ widths <- unit.c( plot_table $ widths [ - ncol(plot_table )], tag_width )
316
316
plot_table <- gtable_add_grob(plot_table , tag , name = " tag" ,
317
317
t = 1 , b = nrow(plot_table ), l = ncol(plot_table ),
318
318
clip = " off" )
319
319
} else if (tag_pos == " bottomleft" ) {
320
- plot_table $ widths [ 1 ] <- tag_width
321
- plot_table $ heights [ nrow(plot_table )] <- tag_height
320
+ plot_table $ widths <- unit.c( tag_width , plot_table $ widths [ - 1 ])
321
+ plot_table $ heights <- unit.c( plot_table $ heights [ - nrow(plot_table )], tag_height )
322
322
plot_table <- gtable_add_grob(plot_table , tag , name = " tag" ,
323
323
t = nrow(plot_table ), l = 1 , clip = " off" )
324
324
} else if (tag_pos == " bottom" ) {
325
- plot_table $ heights [ nrow(plot_table )] <- tag_height
325
+ plot_table $ heights <- unit.c( plot_table $ heights [ - nrow(plot_table )], tag_height )
326
326
plot_table <- gtable_add_grob(plot_table , tag , name = " tag" ,
327
327
t = nrow(plot_table ), l = 1 , r = ncol(plot_table ), clip = " off" )
328
328
} else if (tag_pos == " bottomright" ) {
329
- plot_table $ widths [ ncol(plot_table )] <- tag_width
330
- plot_table $ heights [ nrow(plot_table )] <- tag_height
329
+ plot_table $ widths <- unit.c( plot_table $ widths [ - ncol(plot_table )], tag_width )
330
+ plot_table $ heights <- unit.c( plot_table $ heights [ - nrow(plot_table )], tag_height )
331
331
plot_table <- gtable_add_grob(plot_table , tag , name = " tag" ,
332
332
t = nrow(plot_table ), l = ncol(plot_table ), clip = " off" )
333
333
}
0 commit comments