ggplot2 (version 1.0.1)

stat_ydensity: 1d kernel density estimate along y axis, for violin plot.

Description

1d kernel density estimate along y axis, for violin plot.

Usage

stat_ydensity(mapping = NULL, data = NULL, geom = "violin",
  position = "dodge", adjust = 1, kernel = "gaussian", trim = TRUE,
  scale = "area", na.rm = FALSE, ...)

Arguments

mapping
The aesthetic mapping, usually constructed with aes or aes_string. Only needs to be set at the layer level if you are overriding the plot defaults.
data
A layer specific dataset - only needed if you want to override the plot defaults.
geom
The geometric object to use display the data
position
The position adjustment to use for overlappling points on this layer
adjust
see density for details
kernel
kernel used for density estimation, see density for details
trim
If TRUE (default), trim the tails of the violins to the range of the data. If FALSE, don't trim the tails.
scale
if "area" (default), all violins have the same area (before trimming the tails). If "count", areas are scaled proportionally to the number of observations. If "width", all violins have the same maximum width.
na.rm
If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values.
...
other arguments passed on to layer. This can include aesthetics whose values you want to set, not map. See layer for more details.

Value

  • A data frame with additional columns:
  • densitydensity estimate
  • scaleddensity estimate, scaled to maximum of 1
  • countdensity * number of points - probably useless for violin plots
  • violinwidthdensity scaled for the violin plot, according to area, counts or to a constant maximum width
  • nnumber of points
  • widthwidth of violin bounding box

Aesthetics

[results=rd,stage=build]{ggplot2:::rd_aesthetics("stat", "ydensity")} # See geom_violin for examples # Also see stat_density for similar examples with data along x axis geom_violin for examples, and stat_density for examples with data along the x axis.