title: Optimize ggplot to vectorial graphical device
body: <p>Let's say I want to save all my charts (for font and axis style consistency) via a vectorial graphical device (such as <code>pdf()</code>). </p>
  
  <p>Yet sometime some graph is overly complicated - although still visually acceptable - consisting of many overlapping objects, which create a heavy vectorial image that might create problems when embedded in a PDF document (very slow rendering). </p>
  
  <p>I am wonder if it is possible to have <code>ggplot</code> to simplify a <code>geom_point</code> still maintaining  the same aspect before sending it to a graphical device. (Yes, I know I could drop altogether plotting points and plot - for example - a heatmap or a binhex...)</p>
  
  <p>For example this MWE plot 5000 datapoints</p>
  
  <pre><code>library(ggplot2)
  
  pdf("SampleGraph.pdf",width=7,height=5)
  df &lt;- data.frame(x = rnorm(5000), y = rnorm(5000))
  ggplot (df, aes(x, y)) + geom_point(size=5, alpha=.5)
  dev.off()
  </code></pre>
  
  <p>and the resulting <code>SampleGraph.pdf</code>is 300kb but even with alpha=.5 most of the points are totally obscured by others. </p>