Use ggplot2 to draw a normal distribution

library(ggplot2)
x_lim_low <- -3
x_lim_up <- 3
p2 <- ggplot(data.frame(x = c(x_lim_low, x_lim_up)), aes(x)) +
  stat_function(
    fun = dnorm,
    geom = "line") +
  xlab("") +
  ylab("") +
  scale_x_continuous(breaks = NULL) +
  scale_y_continuous(breaks = NULL)
p2


charlotte-ngs/lbgfs2021 documentation built on Dec. 19, 2021, 3:01 p.m.