Learn R Programming

egg (version 0.4.5)

geom_custom: geom_custom

Description

Draw user-defined grobs, typically annotations, at specific locations.

Usage

geom_custom(mapping = NULL, data = NULL, inherit.aes = TRUE, ...)

Arguments

mapping

mapping

data

data

inherit.aes

inherit.aes

...

arguments passed to the geom's draw_group method

Value

layer

Examples

Run this code
# NOT RUN {
library(grid)
d <- data.frame(x=rep(1:3, 4), f=rep(letters[1:4], each=3))
gl <- replicate(4, matrix(sample(palette(), 9, TRUE), 3, 3), FALSE)
dummy <- data.frame(f=letters[1:4], data = I(gl))
ggplot(d, aes(f,x)) +
  facet_wrap(~f)+
  theme_bw() +
  geom_point()+
  geom_custom(data = dummy, aes(data = data, y = 2),
              grob_fun = function(x) rasterGrob(x, interpolate = FALSE,
                                                width=unit(1,'cm'),
                                                height=unit(1,'cm')))
# }

Run the code above in your browser using DataLab