| plot_density | R Documentation |
Kernel density plot for one or multiple numeric columns.
plot_density(
data,
label_x = "",
label_y = "",
colors = NULL,
bin = NULL,
alpha = 0.25
)
data |
data.frame with one or more numeric columns |
label_x |
x‑axis label |
label_y |
y‑axis label |
colors |
optional fill color (single column) or vector for groups |
bin |
optional bin width passed to |
alpha |
fill transparency (0–1) |
If data has multiple numeric columns, densities are overlaid and filled by column (group).
When a single column is provided, colors (if set) is used as a constant fill.
The bin argument is passed to geom_density(binwidth=...).
returns a ggplot2::ggplot graphic
grf <- plot_density(iris |> dplyr::select(Sepal.Width), colors="blue")
plot(grf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.