\HeaderA{ggdensity}{Grob function: 1d density}{ggdensity}
\keyword{hplot}{ggdensity}
\begin{Description}\relax
Display a smooth density estimate.
\end{Description}
\begin{Usage}
\begin{verbatim}ggdensity(plot = .PLOT, aesthetics=list(), ..., data=NULL)\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{plot}] the plot object to modify
\item[\code{aesthetics}] named list of aesthetic mappings, see details for more information
\item[\code{...}] other options, see details for more information
\item[\code{data}] data source, if not specified the plot default will be used
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Aesthetic mappings that this grob function understands:

\Itemize{
\item \code{x}:x position (required)
\item \code{weight}: observation weights
}

These can be specified in the plot defaults (see \code{\LinkA{ggplot}{ggplot}}) or
in the \code{aesthetics} argument.  If you want to modify the position
of the points or any axis options, you will need to add a position scale to
the plot.  These functions start with \code{ps}, eg.
\code{\LinkA{pscontinuous}{pscontinuous}} or \code{\LinkA{pscategorical}{pscategorical}}

Other options:

\Itemize{
\item \code{adjust}: see \code{\LinkA{density}{density}}
for details
\item \code{kernel}: kernel used for density estimation, see \code{\LinkA{density}{density}}
for details
\item other aesthetic properties passed on to \code{\LinkA{ggline}{ggline}}
\item \code{weight}: observation weights
}
\end{Details}
\begin{Author}\relax
Hadley Wickham <h.wickham@gmail.com>
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{gghistogram}{gghistogram}}, \code{\LinkA{density}{density}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}m <- ggplot(movies, aesthetics=list(x=rating))
ggdensity(m)
qplot(length, data=movies, type="density")
qplot(length, data=movies, type="density", weight=rating)
qplot(length, data=movies, type="density", weight=rating/sum(rating))
qplot(length, data=movies, type="density", log="x")
qplot(log(length), data=movies, type="density")
m <- ggplot(movies, Action ~ Comedy, aesthetics=list(x=rating), margins=TRUE)
ggdensity(m)
ggdensity(m, scale="freq")
ggdensity(m, colour="darkgreen", size=5) \end{ExampleCode}
\end{Examples}

