How to plot a normal distribution by labeling specific parts of the x-axis?

后端 未结 7 1809
轻奢々
轻奢々 2020-12-03 00:01

I am using the following code to create a standard normal distribution in R:

x <- seq(-4, 4, length=200)
y <- dnorm(x, mean=0, sd=1)
plot(x, y, type=\"         


        
相关标签:
7条回答
  • 2020-12-03 00:29

    Using the code in this answer, you could skip creating x and just use curve() on the dnorm function:

    curve(dnorm, -3.5, 3.5, lwd=2, axes = FALSE, xlab = "", ylab = "")
    axis(1, at = -3:3, labels = c("-3s", "-2s", "-1s", "mean", "1s", "2s", "3s"))
    

    But this doesn't use the given code anymore.

    0 讨论(0)
提交回复
热议问题