Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ggdraw

Set up a drawing layer on top of a ggplot


Description

Set up a drawing layer on top of a ggplot.

Usage

ggdraw(plot = NULL, xlim = c(0, 1), ylim = c(0, 1), clip = "off")

Arguments

plot

The plot to use as a starting point. Can be a ggplot2 plot, an arbitrary grob or gtable, or a recorded base-R plot, as in as_grob().

xlim

The x-axis limits for the drawing layer.

ylim

The y-axis limits for the drawing layer.

clip

Should drawing be clipped to the set limits? The default is no ("off").

Examples

library(ggplot2)

p <- ggplot(mpg, aes(displ, cty)) +
  geom_point() +
  theme_minimal_grid()
ggdraw(p) + draw_label("Draft", colour = "#80404080", size = 120, angle = 45)

cowplot

Streamlined Plot Theme and Plot Annotations for 'ggplot2'

v1.1.1
GPL-2
Authors
Claus O. Wilke [aut, cre] (<https://orcid.org/0000-0002-7470-9261>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.