0

I want to be able to show three different density curves on the same axis. I've got the code below so far but i don't know how to combine them to so that they can

curve(dnorm(x,mean=0,sd=1),col="darkgreen",xlim=c(-4,8),ylim=c(0,.8))
curve(dnorm(x,mean = 0,sd=1.5),col="red",xlim = c(-5,8),ylim=c(0,.6))
curve(dnorm(x,mean = 0.5,sd=0.5),col="black",xlim = c(-2,8), ylim =c(0,1))
phiver
  • 23,048
  • 14
  • 44
  • 56

1 Answers1

0

This is the basic solution. You can add more formatting if need be (for axes etc). Note you need to change the xlim and ylim to match on the plots.

curve(dnorm(x,mean=0,sd=1),col="darkgreen",xlim=c(-5,8),ylim=c(0,1), ylab = "")
par(new = TRUE)
curve(dnorm(x,mean = 0,sd=1.5),col="red",xlim = c(-5,8),ylim=c(0,1), ylab = "")
par(new = TRUE)
curve(dnorm(x,mean = 0.5,sd=0.5),col="black",xlim = c(-5,8), ylim =c(0,1), ylab = "")
JCollerton
  • 3,227
  • 2
  • 20
  • 25