gtable_add_space: Add row/column spacing.

Description Usage Arguments Value See Also Examples

Description

Adds width space between the columns or height space between the rows, effictvely pushing the existing cells apart.

Usage

1
2
3

Arguments

x

a gtable object

width

a vector of units of length 1 or ncol - 1

height

a vector of units of length 1 or nrow - 1

Value

A gtable with the additional rows or columns added

See Also

Other gtable manipulation: gtable_add_cols, gtable_add_grob, gtable_add_padding, gtable_add_rows, gtable_filter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(grid)

rect <- rectGrob()
rect_mat <- matrix(rep(list(rect), 9), nrow = 3)

gt <- gtable_matrix("rects", rect_mat, widths = unit(rep(1, 3), "null"),
                    heights = unit(rep(1, 3), "null"))

plot(gt)

# Add spacing between the grobs
# same height between all rows
gt <- gtable_add_row_space(gt, unit(0.5, "cm"))

# Different width between the columns
gt <- gtable_add_col_space(gt, unit(c(0.5, 1), "cm"))

plot(gt)

Example output



gtable documentation built on May 2, 2019, 3:44 a.m.