title: Draw a line after persp using rsm in R
body: <p>I used the following code to draw a 3d response surface with contour projection on the x-y plane in R using the persp function of the RSM package.</p>
  
  <pre><code>x &lt;- seq(-3,3,by=0.25) 
  y &lt;- seq(-3,3,by=0.25) 
  d &lt;- expand.grid(x=x,y=y)
  z &lt;- c(data=NA,1089)
  b0 = 5.628; b1 = 0; b2 = 0; b3 = -.1 ; b4 =.1; b5 = -.1
  k=1
  for (i in 1:25) {
  for (j in 1:25) {
  z[k]=b0+b1*x[i]+b2*y[j]+b3*x[i]*x[i]+b4*x[i]*y[j]+ b5*y[j]*y[j]
  k=k+1
  }  }
  library(rsm)
  data.lm &lt;- lm(z~poly(x,y,degree=2),data=d)
  persp(data.lm,x~y, zlim=c(0,max(z)),contour=list(z="bottom",col="colors"),theta=-55,phi=25)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/AWuTp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AWuTp.png" alt="enter image description here"></a>
  after drawing this diagram, is there a way that I can:</p>
  
  <p>(1) draw an additional line, e.g, y=5x+8 on the persp x-y plane?</p>
  
  <p>(2) project a scatter plot of z on the x-y plane?</p>