View source: R/geom-density-line.R
geom_density_line | R Documentation |
This function is a drop-in replacement for ggplot2's geom_density()
. The only difference is that
the geom draws a ridgeline (line with filled area underneath) rather than a polygon.
geom_density_line(
mapping = NULL,
data = NULL,
stat = "density",
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
See geom_density()
.
library(ggplot2)
ggplot(diamonds, aes(carat)) +
geom_density_line()
ggplot(diamonds, aes(carat)) +
geom_density_line(adjust = 1/5)
ggplot(diamonds, aes(carat)) +
geom_density_line(adjust = 5)
ggplot(diamonds, aes(depth, colour = cut)) +
geom_density_line(alpha = 0.5) +
xlim(55, 70)
ggplot(diamonds, aes(depth, fill = cut, colour = cut)) +
geom_density_line(alpha = 0.1) +
xlim(55, 70)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.