title: Difference between passing options in aes() and outside of it in ggplot2
body: <p>After fiddling with point size options in ggplot2, I noticed examples in which size was passed both inside and outside the <code>aes()</code> parameter of <code>geom_point()</code>. From the <a href="http://had.co.nz/ggplot2/geom_point.html" rel="noreferrer">`geom_point() page on Hadley's site</a>:</p>
  
  <pre><code>p &lt;- ggplot(mtcars, aes(wt, mpg))
  
  # passed inside
  p + geom_point(aes(size = qsec)) 
  p + geom_point(aes(size = qsec)) + scale_area() 
  
  # passed outside
  p + geom_point(colour = "red", size = 3) 
  p + geom_point(colour = "grey50", size = 4)
  </code></pre>
  
  <p>I've found these behave differently when it comes to legends. When passing inside <code>aes()</code> I can get a legend to appear, though I need to set breaks even though I only have two differently sized points; otherwise, I get a range of five point sizes even though only 2 are used.</p>
  
  <p>Also, the sizes passed aren't understandably meaningful; I need to specify the relative size using <code>range=c(min,max)</code> and set breaks to just two sizes instead of the default five.</p>
  
  <p>If I pass size outside of <code>aes()</code>, the sizes seem honored but I can't get a legend on my plot; I tried <code>scale_size</code>, <code>scale_size_continuous</code>, and <code>scale_size_manual</code> without success.</p>
  
  <p>From the <code>geom_point()</code> page there's this:</p>
  
  <blockquote>
    <p>The following aesthetics can be used with geom_point. Aesthetics are
    mapped to variables in the data with the aes function: <code>geom_point(aes(x = var))</code></p>
    
    <p>...</p>
    
    <p>Scales control how the variable is mapped to the aesthetic and are listed after each aesthetic.</p>
    
    <p>[Listing of all the aesthetic options here (shape, colour, size, etc.)]</p>
  </blockquote>
  
  <p>From that, it's still not exactly clear how the options (size in this question, but this should be meaningful for other aesthetics) inside and outside of <code>aes()</code> affect the result.</p>