 <p>The problem here is that <code>plot</code> needs a function that returns one value and not a vector.</p> <p>One workaround would be to loop over your <code>b</code> and <code>w</code> values one by one and redefine your <code>k</code> function as you go. I've also changed your <code>k</code> function as it wasn't defined for the default parameters.</p> <pre><code>k &lt;- function(b, w) { function(x){b*x+w} } plot2 &lt;- function(k, b, w) { plot(k(b[1], w[1])) for (i in 2:length(b)) { foo &lt;- k(b[i], w[i]) curve(foo, add = TRUE) } } plot2(k, b, w) </code></pre>