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
|
#' Display a smooth density estimate.
#'
#' A smooth density estimate calculated by \code{\link{stat_density}}.
#'
#' @section Aesthetics:
#' \Sexpr[results=rd,stage=build]{ggplot2:::rd_aesthetics("geom", "density")}
#'
#' @seealso \code{\link{geom_histogram}} for the histogram and
#' \code{\link{stat_density}} for examples.
#' @inheritParams geom_point
#' @export
#' @examples
#' # See stat_density for examples
geom_density <- function (mapping = NULL, data = NULL, stat = "density", position = "identity",
na.rm = FALSE, ...) {
GeomDensity$new(mapping = mapping, data = data, stat = stat, position = position,
na.rm = na.rm, ...)
}
GeomDensity <- proto(GeomArea, {
objname <- "density"
default_stat <- function(.) StatDensity
default_pos <- function(.) PositionIdentity
default_aes <- function(.) defaults(aes(fill=NA, weight=1, colour="black", alpha = NA), GeomArea$default_aes())
})
|