title: Use different colors/shapes for scatterplot with two groups in R
body: <p>I am currently using the lattice package in R to create a scatterplot matrix, using the splom function. My dataset has two groups in it, labeled in two different columns, as such:</p>
  
  <pre><code>PC1 PC2 PC3 Group1 Group2
  1   2   3   A      X
  1   2   3   B      X
  1   2   3   C      X
  1   2   3   D      X
  1   2   3   A      Y
  1   2   3   B      Y
  1   2   3   C      Y
  1   2   3   D      Y
  1   2   3   A      Z
  1   2   3   B      Z
  1   2   3   C      Z
  1   2   3   D      Z
  </code></pre>
  
  <p>I can get the splom function to use different colors and shapes for one of the groups, but not for both, using the following code:</p>
  
  <pre><code>splom(~pcVT[,1:3], data = pcVT, xlab = NULL, groups = Group1, pch = c(1,2,3),
  col = super.sym$col[1:3], panel = panel.superpose, 
  key = list(points = list(pch = c(1,2,3),col = super.sym$col[1:3]),text = list(mylabels)))
  </code></pre>
  
  <p>How could I get it to use the two groups for the coloring and shapes - i.e., I want Group1 to be graphed based on color, and Group2 to be graphed based on shape. Alternatively, if splom can't do this, is there a nice way to do it using gpplot2?</p>
  
  <p>Many thanks!</p>