View source: R/e_plot_function_limit_range.R
e_plot_function_limit_range | R Documentation |
Limit the range of values from a distribution function
e_plot_function_limit_range(fun = dnorm, min = -Inf, max = +Inf, ...)
fun |
function, such as distribution function like |
min |
min value to include in range |
max |
max value to include in range |
... |
arguments passed to fun |
filtered range of the function
f_dnorm_limit <- e_plot_function_limit_range(dnorm, 0, 2)
f_dnorm_limit(-2:4)
library(ggplot2)
p <- ggplot(data.frame(x = c(-3, 3)), aes(x = x))
p <- p + stat_function(fun = dnorm)
p <- p + stat_function(fun = e_plot_function_limit_range(dnorm, 0, 2)
, geom = "area", fill = "blue", alpha = 0.2)
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.