Evaluates fn over the panel's x range and draws the result. Handy for
overlaying a theoretical density or a reference curve on data.
geom_function(
fn,
xlim = c(0, 1),
n = 101,
color = NULL,
linewidth = NULL,
alpha = NULL
)A Layer to add with +.
ggnext(data.frame(x = c(-3, 3)), aes(x)) +
geom_function(dnorm, xlim = c(-3, 3))
#> <ggnext plot>
#> data: 2 x 1
#> aes: x = x
#> layers: 1
#> coord: cartesian
#> mode: static