View source: R/geom-density-line.R
geom_density_line | R Documentation |
This function is a drop-in replacement for ggplot2's ggplot2::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.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
... |
Other arguments passed on to
|
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
See ggplot2::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.