title: Contour plot for quadratic equation in R
body: <p>I'm trying to recreate contour plot shown in the picture below using R.
  It is a contour plot of constant syrup loss as a function of speed and pressure.</p>
  
  <p><img src="https://i.stack.imgur.com/q778y.png" alt="Contours of constant syrup loss as a function of speed and pressure"></p>
  
  <p>Data used for this example:</p>
  
  <pre><code>speed      = c(100,100,100,100,100,100,120,120,120,120,120,120,140,140,140,140,140,140)
  pressure   = c(10,10,15,15,20,20,10,10,15,15,20,20,10,10,15,15,20,20)
  syrup_loss = c(-35,-25,110,75,4,5,-45,-60,-10,30,-40,-30,-40,15,80,54,31,36)
  </code></pre>
  
  <p>With that data quadratic equation was created:</p>
  
  <pre><code>model &lt;- lm(syrup_loss~speed + pressure + speed^2 + pressure^2 + speed*pressure)
  summary(model)
  </code></pre>
  
  <p>Which gives:</p>
  
  <p>z = 1217.30556 - 31.25625*x + 86.01667*y + 0.1291*x^2  - 2.87333*y^2 + 0.02875*x*y</p>
  
  <p>I tried creating contour plot using this code, but it doesn't give acceptable result:</p>
  
  <pre><code>x = seq(100, 140, len=100)
  y = seq( 10,  20, len=100)
  z = outer(x, 1217.30556 - 31.25625*x + 86.01667*y + 0.1291*x^2 - 
               2.87333*y^2 + 0.02875*x*y)
  contour(x, y, z, nlev=12)
  </code></pre>