title: How to create a legend from scratch which is not in aes of ggplot2?
body: <p>Continue my question here: <a href="https://stackoverflow.com/questions/21271278">Variable line size using ggplot2</a></p>
  
  <p>I can create a figure with these codes.</p>
  
  <pre><code>x &lt;- 1:100
  y &lt;- x * x 
  z &lt;- abs(cos(x * pi / (max(x))))
  
  df &lt;- data.frame(x = x, y = y, z = z)
  library(ggplot2)
  
  
  mult &lt;- 200
  ggplot(df, aes(x, y)) + geom_line() + geom_ribbon(aes(ymin=y-mult*z, ymax=y+mult*z))
  </code></pre>
  
  <p>But my question now is how to create a legend to reflect the size of line. For example, legend in this figure</p>
  
  <pre><code>    ggplot(df, aes(x, y, size = z)) + geom_line()
  </code></pre>
  
  <p>Is there any way to and a legend from scratch which doesn't exist in the aes?</p>
  
  <p>Thanks for any suggestions.</p>