title: Multiple plots using curve() function (e.g. normal distribution)
body: <p>I am trying to <strong>plot multiple functions using curve()</strong>. My example tries to plot multiple normal distributions with different means and the same standard deviation. </p>
  
  <pre><code>png("d:/R/standardnormal-different-means.png",width=600,height=300)
  #First normal distribution 
  curve(dnorm, 
      from=-2,to=2,ylab="d(x)",
      xlim=c(-5,5))
  abline(v=0,lwd=4,col="black")
  
  #Only second normal distribution is plotted
  myMean &lt;- -1
  curve(dnorm(x,mean=myMean), 
      from=myMean-2,to=myMean+2,
      ylab="d(x)",xlim=c(-5,5), col="blue")
  abline(v=-1,lwd=4,col="blue")
  dev.off()
  </code></pre>
  
  <p>As the curve() function creates a new plot each time, <strong>only the second normal distribution is plotted</strong>. </p>
  
  <p><a href="https://i.stack.imgur.com/jj105.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jj105.png" alt="Plot (shows only second normal distribution)"></a></p>