grid_panel: Add a 'grid' Layer.

Description Usage Arguments Details Author(s) Examples

View source: R/grid_panel.R

Description

Adds a layer to a ggplot2 plot based on a raw grid grob or on a function that generates a 'grid' grob.

Usage

1
2
3
4
5
6
grid_panel(grob = nullGrob(),
           mapping = NULL, data = NULL, stat = "identity",
           position = "identity", inherit.aes = TRUE, debug = NULL, ...)
grid_group(grob = nullGrob(),
           mapping = NULL, data = NULL, stat = "identity",
           position = "identity", inherit.aes = TRUE, debug = NULL, ...)

Arguments

grob

Either a grid grob or a function. The function must accept two arguments (data and coords) and must return a grid grob.

mapping, data, stat, position, inherit.aes

Standard arguments to a ggplot2 Geom.

debug

Either NULL or a function. The function must accept two arguments (data and coords) and will usually just print debugging output of some kind.

...

Other arguments passed on to ggplot2::layer().

Details

The grid_panel() function will draw the grob, or call the grob function, once for each ggplot2 panel.

The grid_group() function will draw the grob, or call the grob function, once for each ggplot2 group.

Author(s)

Paul Murrell

Examples

1
2
3
4
5
6
7
tg <- textGrob("label",
               x=unit(1, "npc") - unit(2, "mm"),
               y=unit(1, "npc") - unit(2, "mm"),
               just=c("right", "top"))
ggplot(mtcars) +
    geom_point(aes(disp, mpg)) +
    grid_panel(tg)

gggrid documentation built on Nov. 22, 2021, 9:06 a.m.