ggplot2 scale_y_continous sometimes makes graph not visible
<p>When creating a density plot using ggplot, I find that sometimes the curve would disappear when I set limits using scale_y_continuous.  I am hoping for an explanation.</p>

<pre><code>library(ggplot2)
library(gridExtra)
n=20  #number of simulations runs
X=data.frame(v=runif(n,.5,1))

#X %&gt;% filter(X&lt;20) %&gt;% ggplot(aes(v))+geom_density()
p=X  %&gt;% ggplot(aes(v))+geom_density()
p1=p+scale_y_continuous(limits=c(0,3.2))
p2=p+scale_y_continuous(limits=c(0.2,3.2))
p3=p+scale_y_continuous(limits=c(-0.2,3.2))

grid.arrange(p1,p2,p3,ncol=3)
</code></pre>

<p>Here is the figure  created:</p>

<p><img src="https://i.stack.imgur.com/dRKok.png" alt="enter image description here"></p>

<p>Note that for the middle image, the curve is not visible.</p>