Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gtable_add_padding

Add padding around edges of table.


Description

This is a convenience function for adding an extra row and an extra column at each edge of the table.

Usage

gtable_add_padding(x, padding)

Arguments

x

a gtable() object

padding

vector of length 4: top, right, bottom, left. Normal recycling rules apply.

Value

A gtable object

See Also

Examples

library(grid)
gt <- gtable(unit(1, "null"), unit(1, "null"))
gt <- gtable_add_grob(gt, rectGrob(gp = gpar(fill = "black")), 1, 1)

plot(gt)
plot(cbind(gt, gt))
plot(rbind(gt, gt))

pad <- gtable_add_padding(gt, unit(1, "cm"))
plot(pad)
plot(cbind(pad, pad))
plot(rbind(pad, pad))

gtable

Arrange 'Grobs' in Tables

v0.3.0
GPL-2
Authors
Hadley Wickham [aut, cre], Thomas Lin Pedersen [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.