# Plot the normal density
tinyplot(x = -4:4, type = type_function(dnorm))
# Extra arguments for the function to plot
tinyplot(x = -1:10, type = type_function(
fun = dnorm, args = list(mean = 3)
))
# Additional arguments are passed to the `lines()` function.
tinyplot(x = -4:4, type = type_function(
fun = dnorm,
col = "pink", type = "p", pch = 3
))
# Custom function example
# (Here using the `\()` anonymous function syntax introduced in R 4.1.0)
tinyplot(x = -4:4, type = type_function(fun = \(x) 0.5 * exp(-abs(x))))
Run the code above in your browser using DataLab