title: Draw 3D plot of two classes according to 3 variables with R
body: <p>I have an R data.frame:</p>
  
  <pre><code>&gt; str(trainTotal)
  'data.frame':   1000 obs. of  41 variables:
   $ V1   : num  0.299 -1.174 1.192 1.573 -0.613 ...
   $ V2   : num  -1.227 0.332 -0.414 -0.58 -0.644 ...
     etc.
   $ V40  : num  0.101 -1.818 2.987 1.883 0.408 ...
   $ Class: int  1 0 0 1 0 1 0 1 1 0 ...
  </code></pre>
  
  <p>and I would like to draw a 3D scatter plot of Class "0" in blue and Class "1" in red according to V13, V5, and V24.</p>
  
  <p>V13, V5, V24 are the top variables when sorted by scaled variance, so my intuition tells me the 3D visualization could be interesting. Not sure if that makes sense.</p>
  
  <p>How can I plot this with R ?</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>I have tried the following:</p>
  
  <pre><code>install.packages("Rcmdr")
  library(Rcmdr)
  
  scatter3d(x=trainTotal[[13]], y= trainTotal[[5]], z= trainTotal[[24]], point.col = as.numeric(as.factor(trainTotal[,41])), size = 10)
  </code></pre>
  
  <p>which gives me this plot:
  <img src="https://i.stack.imgur.com/gkk02.png" alt="enter image description here"></p>
  
  <p>I am not sure how to read this plot. </p>
  
  <p>I would prefer to see only dots of two colors, for a start.</p>