View source: R/plot_distributions.R
plot_distributions | R Documentation |
Plot several distributions
plot_distributions(
...,
distributions = list(),
.x,
plots = c("density", "probability", "hazard"),
with_params = list(),
as_list = FALSE
)
... |
distribution objects (must be named) |
distributions |
Named list of distribution objects.
This is concatenated with |
.x |
Numeric vector of points to evaluate at. |
plots |
Plots to be created. May be abbreviated. The plots will be stacked in the order given from top to bottom. |
with_params |
list of distribution parameters to be given to each
distribution using |
as_list |
return a list of ggplots instead of a patchwork? |
A stacked patchwork of the requested ggplots
rate <- 1
x <- rexp(20, rate)
d_emp <- dist_empirical(x, positive = TRUE)
d_exp <- dist_exponential()
plot_distributions(
empirical = d_emp,
theoretical = d_exp,
estimated = d_exp,
with_params = list(
theoretical = list(rate = rate),
estimated = list(rate = 1 / mean(x))
),
.x = seq(1e-4, 5, length.out = 100)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.