title: Consistent legend colors with qplot
body: <p>Consider the following data frame:</p>
  
  <pre><code>x = read.table(text = 'Lo Re Pe
  1 T 33
  1 F 22
  1 H 11
  2 T 22
  2 F 22', header = TRUE)
  </code></pre>
  
  <p>and the following plot:</p>
  
  <pre><code>qplot(factor(Lo), data=x, geom='bar', fill=Re, weight=Pe, 
        xlab='L', main='Title', ylab='Pe')
  </code></pre>
  
  <p>Now consider this data frame:</p>
  
  <pre><code>x &lt;- read.table(text = 'Lo Re Pe
  1 D 33
  1 K 22
  2 D 22
  2 K 22', header=TRUE)
  </code></pre>
  
  <p>with the same <code>qplot</code> statement.</p>
  
  <p>The colors assigned to each <code>Re</code> value are not consistent between the plots, so it is difficult to compare the plots directly.</p>
  
  <p>How do I specify that <code>Re</code> value <code>T</code> should always be "Red", for example, and that <code>Re</code> value <code>F</code> should always be "Blue", for example, so that the <code>qplot</code> command always uses <strong>consistent</strong> colors for each <code>Re</code> value, regardless of the contents of the data frame? There are a finite and known number of values for <code>Re</code>, so I could specify them all.</p>
  
  <p>I tried the following when the data frame contained values <code>T</code>, <code>F</code> and <code>H</code>:</p>
  
  <pre><code>qplot(factor(Lo), data=x, geom='bar', fill=Re, weight=Pe, 
        xlab='Loci', main='Title', ylab='Pe', 
        scale_fill_manual(values=c("Blue","Red","Green"),labels=c("T","F","H")))
  </code></pre>
  
  <p>but R reports an error about incorrect length and does not produce a plot.</p>
  
  <p>The solution would ideally allow me to specify colors for all possible values of <code>Re</code>, even though all of these may not be present in the data frame.</p>