% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ggplot-geom-gshape.R
\name{draw_key_gshape}
\alias{draw_key_gshape}
\title{Key glyphs for legends}
\usage{
draw_key_gshape(data, params, size)
}
\arguments{
\item{data}{A single row data frame containing the scaled aesthetics to
display in this key}

\item{params}{A list of additional parameters supplied to the geom.}

\item{size}{Width and height of key in mm.}
}
\value{
A grid grob.
}
\description{
Each geom has an associated function that draws the key when the geom needs
to be displayed in a legend. These functions are called \verb{draw_key_*()}, where
\code{*} stands for the name of the respective key glyph. The key glyphs can be
customized for individual geoms by providing a geom with the \code{key_glyph}
argument. The \code{draw_key_gshape} function provides this interface for custom
key glyphs used with \code{\link[=geom_gshape]{geom_gshape()}}.
}
\examples{
p <- ggplot(economics, aes(date, psavert, color = "savings rate"))
# key glyphs can be specified by their name
p + geom_line(key_glyph = "timeseries")

# key glyphs can be specified via their drawing function
p + geom_line(key_glyph = draw_key_rect)
}
