title: Color PCA depending on predefined groups?
body: <p>I have a problem, when i try to do a PCA plot on some gene expression data, i use the code below to plot it, but i would like to make different colors depending on which category a Tissue belongs to.</p>
  
  <pre><code>data &lt;- read.table("rmaFinal.txt", row.names=1, sep="\t",header=TRUE, dec=".")
  pca &lt;- prcomp(t(data), cor=TRUE)
  plot(pca$x, pch=20) 
  </code></pre>
  
  <p>My data is formatted as</p>
  
  <pre><code>      Tissue1 tissue2 tissue3
  Gene1 1        2       3
  Gene2 2        3       4
  Gene3 3        4       5
  </code></pre>
  
  <p>I have a total of 116 different tissues, that all can be classified into a total of 12 categories. I therefore have a list like this, with the category of each of the 116 tissue types.</p>
  
  <pre><code>category = c( "Seed","Seed","Seed","Stem","Seed","Seed","Seed","Mesocotyl","Spikelets")
  </code></pre>
  
  <p>I would like to color my PCA plot depending on which of the 12 categories a given sample is present in. 
  I have tried to read around, but none of the solutions i could find did work for this.
  How do i combine the category list with the PCA plot? </p>