【R 语言 可视化】在直方图上面添加密度曲线

rm(list=ls())
gc()
set.seed(1234)
score <- rnorm(n = 1000, m = 80, sd = 20)
hist(score, 
     freq=FALSE, 
     xlab="Score", 
     main="Distribution of score", 
     col="lightgreen", 
     xlim=c(0,150), 
     ylim=c(0, 0.02))
curve(dnorm(x, 
            mean=mean(score), 
            sd=sd(score)), 
      add=TRUE, 
      col="darkblue", 
      lwd=2)

相关文章:

  • 2021-11-08
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
猜你喜欢
  • 2021-10-07
  • 2021-04-26
  • 2021-06-07
  • 2021-11-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案