% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-base.R
\name{geom_function}
\alias{geom_function}
\title{Curve of a function}
\usage{
geom_function(
  fn,
  xlim = c(0, 1),
  n = 101,
  color = NULL,
  linewidth = NULL,
  alpha = NULL
)
}
\arguments{
\item{fn}{A function of one numeric argument.}

\item{xlim}{Length-2 range to evaluate over.}

\item{n}{Number of evaluation points.}

\item{color, linewidth, alpha}{Appearance.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
Evaluates \code{fn} over the panel's x range and draws the result. Handy for
overlaying a theoretical density or a reference curve on data.
}
\examples{
ggnext(data.frame(x = c(-3, 3)), aes(x)) +
  geom_function(dnorm, xlim = c(-3, 3))
}
