# Plot the normal density (default function)
tinyplot(x = -4:4, type = "function")
# tinyplot(x = -4:4, type = type_function()) # same
# Customize by passing explicit arguments to your function
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 `function(x)`, but you could also use the shorter `\(x)`
## anonymous function syntax introduced in R 4.1.0)
tinyplot(x = -4:4, type = type_function(fun = function(x) 0.5 * exp(-abs(x))))
Run the code above in your browser using DataLab