plot_density.RdWrapper around [ggplot2::geom_density()] that plots pretty density plots using a custom ggplot theme.
plot_density(
data,
x_str = NULL,
fill_str = NULL,
fill = "#6FBBE3",
alpha = 0.4,
theme_options = NULL,
show_plot = FALSE,
...
)Data frame to use for plot.
Character string. Name of variable in data to plot on
x-axis. If NULL, plot density using all values in data frame.
Character string (optional). Name of variable in data
to use as fill aesthetic in plot.
Fill color. Used only if fill_str is NULL.
Alpha value for transparency.
(Optional) list of arguments to pass to vthemes::theme_vmodern().
Logical. Should this plot be printed? Default FALSE.
Other arguments to pass to [ggplot2::geom_density()].
A ggplot density.
Other pretty_ggplot_wrappers:
plot_bar(),
plot_boxplot(),
plot_histogram(),
plot_line(),
plot_point()
## plot distribution of all data in data frame
plot_density(as.data.frame(rnorm(1000), nrow = 100))
## plot distribution of a single column in data frame
plot_density(iris, x_str = "Sepal.Width")
plot_density(iris, x_str = "Sepal.Width", fill_str = "Species")