Learn R Programming

lemon (version 0.4.3)

gtable_show_grill: Visualise underlying gtable layout.

Description

Visualises the table structure or the names of the gtable's components.

Usage

gtable_show_grill(x, plot = TRUE)

gtable_show_names(x, plot = TRUE, rect.gp = grid::gpar(col = "black", fill = "white", alpha = 1/4))

Arguments

x

A gtable object. If given a ggplot object, it is converted to a gtable object with ggplotGrob.

plot

Logical. When TRUE (default), draws resulting gtable object on a new page.

rect.gp

Graphical parameters (gpar) for background drop.

Value

Modified gtable object, invisibly.

Details

These functions are highly similar to gtable_show_layout. gtable_show_grill draws the grid of the underlying table, and places row and column indicies in the margin. gtable_show_names replaces the grobs with a semi-transparent rectangle and the component's name.

Examples

Run this code
# NOT RUN {
library(ggplot2)
library(gtable)
library(grid)

p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()

gtable_show_grill(p)
library(ggplot2)
library(gtable)
library(grid)

p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()

gtable_show_names(p)
# }

Run the code above in your browser using DataLab