title: Draw function in ggplot - list of parameters
body: <p>Simple example of a function drawing:</p>
  
  <pre><code>p &lt;- ggplot(data = data.frame(x = 0), mapping = aes(x = x))
  p + stat_function(fun = function(x) x^2 + 1*2)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/aq1Ug.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aq1Ug.png" alt="enter image description here"></a></p>
  
  <p>Is it possible to add a list of parameters inside the plot code in ggplot? 
  Something like this?</p>
  
  <pre><code>fun1 &lt;- function(x) x^2 + a*b
  p &lt;- ggplot(data = data.frame(x = 0), mapping = aes(x = x))
  p + stat_function(fun = fun1, par=list(a=1, b=2)) + xlim(-5,5)
  </code></pre>