Learn R Programming

cowplot (version 0.9.2)

draw_plot: Draw a (sub)plot.

Description

Places a plot somewhere onto the drawing canvas. By default, coordinates run from 0 to 1, and the point (0, 0) is in the lower left corner of the canvas.

Usage

draw_plot(plot, x = 0, y = 0, width = 1, height = 1, scale = 1)

Arguments

plot

The plot to place. Can be a ggplot2 plot, an arbitrary grob or gtable, or a recorded base-R plot, as in plot_to_gtable().

x

The x location of the lower left corner of the plot.

y

The y location of the lower left corner of the plot.

width

Width of the plot.

height

Height of the plot.

scale

Scales the grob relative to the rectangle defined by x, y, width, height. A setting of scale = 1 indicates no scaling.

Examples

Run this code
# NOT RUN {
# make a plot
p <- qplot(1:10, 1:10)
# draw into the top-right corner of a larger plot area
ggdraw() + draw_plot(p, .6, .6, .4, .4)
# }

Run the code above in your browser using DataLab