The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Draw with 'grid' in 'ggplot2'
Version: 0.2-0
Maintainer: Paul Murrell <paul@stat.auckland.ac.nz>
Description: An extension of 'ggplot2' that makes it easy to add raw 'grid' output, such as customised annotations, to a 'ggplot2' plot.
Depends: grid, ggplot2
Suggests: knitr, rmarkdown, vwline
URL: https://github.com/pmur002/gggrid,https://stattech.wordpress.fos.auckland.ac.nz/2021/05/31/2021-01-accessing-grid-from-ggplot2/
VignetteBuilder: knitr
License: GPL-3
NeedsCompilation: no
Packaged: 2022-01-11 00:16:54 UTC; pmur002
Author: Paul Murrell [aut, cre]
Repository: CRAN
Date/Publication: 2022-01-11 09:12:45 UTC

Add a grid Layer.

Description

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

Usage

grid_panel(grob = nullGrob(),
           mapping = NULL, data = NULL, stat = "identity",
           position = "identity", inherit.aes = TRUE, 
           show.legend = FALSE, key_glyph = NULL,
           debug = NULL, ...)
grid_group(grob = nullGrob(),
           mapping = NULL, data = NULL, stat = "identity",
           position = "identity", inherit.aes = TRUE, 
           show.legend = FALSE, key_glyph = NULL, 
           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.

show.legend

Logical indicating whether grob should contribute to the legend.

key_glyph

A function to draw the key glyph in the legend.

...

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.

Note

When adding a key_glyph, the call to grid_panel() or grid_group() must include an explicit mapping.

Author(s)

Paul Murrell

Examples

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)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.