title: How to use polygon() to shade below a probability density curve
body: <p>I'm having trouble getting <code>polygon()</code> to shade <strong>below</strong> the distribution all the way to the x-axis. It seems to shade above the exponential distribution to a <code>y=-x</code> line. Here is where what I have so far:</p>
  
  <pre><code>x &lt;- seq(0,50,0.01)
  y &lt;- dexp(seq(0,50,0.01),rate=0.11)
  plot(x, y, type="l", col=col2rgb("yellow",0.5), xaxs="i", yaxs="i", ylim=c(0,0.15))
  polygon(x, y ,border=NA,col=col2rgb("yellow",0.5))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/yXN3L.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yXN3L.jpg" alt="bad shade"></a></p>
  
  <p>Thanks so much!</p>