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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/legend-draw.R
\name{draw_key}
\alias{draw_key}
\alias{draw_key_point}
\alias{draw_key_abline}
\alias{draw_key_rect}
\alias{draw_key_polygon}
\alias{draw_key_blank}
\alias{draw_key_boxplot}
\alias{draw_key_crossbar}
\alias{draw_key_path}
\alias{draw_key_vpath}
\alias{draw_key_dotplot}
\alias{draw_key_linerange}
\alias{draw_key_pointrange}
\alias{draw_key_smooth}
\alias{draw_key_text}
\alias{draw_key_label}
\alias{draw_key_vline}
\alias{draw_key_timeseries}
\title{Key glyphs for legends}
\usage{
draw_key_point(data, params, size)
draw_key_abline(data, params, size)
draw_key_rect(data, params, size)
draw_key_polygon(data, params, size)
draw_key_blank(data, params, size)
draw_key_boxplot(data, params, size)
draw_key_crossbar(data, params, size)
draw_key_path(data, params, size)
draw_key_vpath(data, params, size)
draw_key_dotplot(data, params, size)
draw_key_linerange(data, params, size)
draw_key_pointrange(data, params, size)
draw_key_smooth(data, params, size)
draw_key_text(data, params, size)
draw_key_label(data, params, size)
draw_key_vline(data, params, size)
draw_key_timeseries(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 (see \code{\link[=layer]{layer()}} or examples below.)
}
\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)
}
|