plot_gamma <- function(n, shape, rate, lab) {
df <- data.frame(x = seq(0, 10, length.out = 1000))
# df <- data.frame(x = rgamma(n, shape = shape, rate = rate))
ggplot(data = df, aes(x = x)) +
stat_function(fun = dgamma,
args = list(shape = shape, rate = rate),
size = 1) +
scale_x_continuous(NULL) +
scale_y_continuous("PDF") +
ggtitle(lab) +
theme_bw()
}
plot_uniform <- function(n, min, max, lab) {
df <- data.frame(x = runif(n, min = min, max = max))
ggplot(data = df, aes(x = x)) +
stat_function(fun = dunif,
args = list(min = min, max = max),
size = 1) +
scale_x_continuous(NULL) +
scale_y_continuous("PDF") +
ggtitle(lab) +
theme_bw()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.