1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/draw.R
\docType{data}
\name{draw_grob}
\alias{draw_grob}
\alias{GeomDrawGrob}
\title{Draw a grob.}
\usage{
draw_grob(
grob,
x = 0,
y = 0,
width = 1,
height = 1,
scale = 1,
clip = "inherit",
hjust = 0,
vjust = 0,
halign = 0.5,
valign = 0.5
)
}
\arguments{
\item{grob}{The grob to place.}
\item{x}{The x location of the grob. (Left side if \code{hjust = 0}.)}
\item{y}{The y location of the grob. (Bottom side if \code{vjust = 0}.)}
\item{width}{Width of the grob.}
\item{height}{Height of the grob.}
\item{scale}{Scales the grob relative to the rectangle defined by \code{x}, \code{y}, \code{width}, \code{height}. A setting
of \code{scale = 1} indicates no scaling.}
\item{clip}{Set to "on" to clip the grob or "inherit" to not clip. Note that clipping doesn't always work as
expected, due to limitations of the grid graphics system.}
\item{hjust, vjust}{Horizontal and vertical justification relative to x.}
\item{halign, valign}{Horizontal and vertical justification of the grob inside
the box.}
}
\description{
Places an arbitrary grob 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.
}
\examples{
# A grid grob (here a blue circle)
g <- grid::circleGrob(gp = grid::gpar(fill = "blue"))
# place into the middle of the plotting area, at a scale of 50\%
ggdraw() + draw_grob(g, scale = 0.5)
}
\keyword{datasets}
|