geom_draw | R Documentation |
Draw ggplot2 layer with a grod or function.
geom_draw( draw = grid::nullGrob(), type = NULL, mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., inherit.aes = TRUE )
draw |
Either a grob object or a function which accepts
two arguments ( |
type |
a scalar character of |
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
inherit.aes |
If |
If you want to combine the functionality of multiple geoms it can
usually be achieved by preparing the data for each of the geoms inside the
draw_*()
call and send it off to the different geoms, collecting the
output in a grid::gList
(a list of grobs) if the call is draw_group()
or a grid::gTree
(a grob containing multiple children grobs) if the
call is draw_panel()
.
a ggplot2 layer object
ggdraw_text <- grid::textGrob( "ggdraw", x = c(0, 0, 0.5, 1, 1), y = c(0, 1, 0.5, 0, 1), hjust = c(0, 0, 0.5, 1, 1), vjust = c(0, 1, 0.5, 0, 1) ) ggplot2::ggplot(data.frame(x = 1, y = 2)) + geom_draw(ggdraw_text)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.