Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (25 sloc) 1.04 KB
#' Contours from a 2d density estimate.
#'
#' Perform a 2D kernel density estimatation using kde2d and display the
#' results with contours.
#'
#' This can be useful for dealing with overplotting.
#'
#' @seealso \code{\link{geom_contour}} for contour drawing geom,
#' \code{\link{stat_sum}} for another way of dealing with overplotting
#' @inheritParams geom_point
#' @inheritParams geom_path
#' @export
#' @examples
#' # See stat_density2d for examples
geom_density2d <- function (mapping = NULL, data = NULL, stat = "density2d", position = "identity",
lineend = "butt", linejoin = "round", linemitre = 1, na.rm = FALSE, ...) {
GeomDensity2d$new(mapping = mapping, data = data, stat = stat, position = position,
lineend = lineend, linejoin = linejoin, linemitre = linemitre, na.rm = na.rm, ...)
}
GeomDensity2d <- proto(GeomPath, {
objname <- "density2d"
default_stat <- function(.) StatDensity2d
default_aes <- function(.) aes(weight=1, colour="#3366FF", size = 0.5, linetype = 1, alpha = 1)
icon <- function(.) GeomContour$icon()
})
Jump to Line
Something went wrong with that request. Please try again.