title: Plotting functions on top of datapoints in R
body: <p>Is there a way of overlaying a mathematical function on top of data using ggplot?</p>
  
  <pre><code>## add ggplot2
  library(ggplot2)
  
  # function
  eq = function(x){x*x}
  
  # Data                     
  x = (1:50)     
  y = eq(x)                                                               
  
  # Make plot object    
  p = qplot(    
  x, y,   
  xlab = "X-axis", 
  ylab = "Y-axis",
  ) 
  
  # Plot Equation     
  c = curve(eq)  
  
  # Combine data and function
  p + c #?
  </code></pre>
  
  <p>In this case my data is generated using the function, but I want to understand how to use <code>curve()</code> with ggplot.</p>