title: Adding a 2nd plane to a scatterplot3d
body: <p>I want to make a prediction for a child's height, based on the fathers+mothers height and the gender and visualize this.</p>
  
  <p>Without the gender variable I can still visualize this in a 3D graph.</p>
  
  <p>But when I add the gender I'd like to have 2 surface plots, one for gender==male and one for gender==female. Is there an elegant way to fix this gender variable in the <code>fit2</code> model, so that I can plot both?</p>
  
  <pre><code>library(fields)
  library(scatterplot3d)
  library(ggplot2)
  library(UsingR)
  
  data(GaltonFamilies)
  attach(GaltonFamilies)
  
  fit &lt;- lm(childHeight ~ mother + father)
  fit2 &lt;- lm(childHeight ~ mother + father + gender)
  
  colorSet &lt;- tim.colors(2)
  s3d &lt;- scatterplot3d(father,mother,childHeight,color=colorSet[gender])
  
  detach(GaltonFamilies)
  
  s3d$plane3d(fit)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/YMBl8.png" alt="scatterplot3d plot"></p>
  
  <p>The fit including gender looks like:</p>
  
  <pre><code>&gt; fit2
  
  Call:
  lm(formula = childHeight ~ mother + father + gender)
  
  Coefficients:
  (Intercept)       mother       father   gendermale  
      16.5212       0.3176       0.3928       5.2150  
  </code></pre>
  
  <p>But when I tryto plot two surface planes for both genders I get an error:</p>
  
  <pre><code>s3d$plane3d(fit2)
  
  Error in segments(x, z1, x + y.max * yx.f, z2 + yz.f * y.max, lty = ltya,  : 
  cannot mix zero-length and non-zero-length coordinates
  </code></pre>
  
  <p>I'd like to have something like this, does anybody know how this is possible?</p>
  
  <pre><code>s3d$plane3d(fit2(gendermale=1))
  s3d$plane3d(fit2(gendermale=0))
  </code></pre>