title: R loses information when saving plot as encapsulated postscript (.eps)
body: <p>Lyx and Latex work splendidly with .eps images. But when I export a scatter plot with a smoothing curve from Rstudio, the points are lost and the plot is delivered with only the curve.  </p>
  
  <p>The two save methods I have tried are:</p>
  
  <ol>
  <li><p>In Rstudio, choose "Export" from the drop down menu in the image field and save as .eps. Interestingly, the plot appears as it should in the Rstudio preview.  </p></li>
  <li><p>Preface the plot code with <code>setEPS()</code> followed by <code>postscript()</code>, with the desired dimensions and so on, followed by the plot call using <code>library(ggplot2)</code>, e.g. <code>ggplot()</code>. </p></li>
  </ol>
  
  <p>At first I thought the problem may be elsewhere. But then I saved a .eps in Mathematica and there was no issue. </p>
  
  <p>I snooped around the internet and found other issues with saving .eps in R, but none dealt with lost information. </p>
  
  <p>What exactly is going on? </p>
  
  <p>I should mention that .eps imager render in Lyx loads better than any other format, so I insist on using .eps. </p>
  
  <p>Many thanks in advance for your input, I cannot yet up-vote them.</p>
  
  <p><strong>EDIT</strong> </p>
  
  <p>So far as I can tell, this question was a dead end due to EPS being unable to keep transparency ribbons. (See comments.) By request I posted code that highlights the problem. </p>
  
  <p>Say you have the data <code>data &lt;- data.frame(replicate(2,rnorm(1000)))</code>. You want to plot them, but there are so many points, so you add a transparency parameter. In addition, you add a fitted line with a confidence interval. Your code is: </p>
  
  <pre><code>ggplot(data = data, aes(x=X1, y=X2)) +
      geom_point(alpha=0.4) +
      stat_smooth(se=T, method="lm")
  </code></pre>
  
  <p>Looks good. But if you try to save the plot as an EPS, all you will see when you later open the saved file is an empty plot object save for the blue fitted line. </p>
  
  <p>Lesson is, if you insist on EPS, you must turn off transparency ribbons. In this case, set <code>alpha=1</code> (or just don't include it) and <code>se=FALSE</code>.</p>