title: How do I manually change the key labels in a legend in ggplot2
body: <p>I am preparing a plot for publication. I created a stacked box plot to show frequency of patients in each group who were some complicated accumulation of seronegatives versus not. The legend is using the labels from the data frame which are appropriate for us who are working on the project but no for publication. I want to change the names to something more rapidly understood by the reader. </p>
  
  <p>So for instance run the following script</p>
  
  <pre><code>grp &lt;- gl(n=4,k=20,labels=c("group a","group b","group c", "group d"))
  value &lt;- runif(n=80, min=10, max=150)
  outcome &lt;- cut(value,2)
  data &lt;- data.frame(grp,value,outcome)
  ggplot(data, aes(grp, fill=outcome)) + geom_bar() +xlab("group") 
               +ylab("number of subjects") + labs(fill="Serologic response")
  </code></pre>
  
  <p>That code creates key labels "(10.4,80]" and "(80,150]" which are not suitable for publication. Instead I would want "double negative" and "positive for a and/or b". </p>
  
  <p>I guess I could go back to the dataframe and transform to get a new variable with the correct labeling. <a href="https://stackoverflow.com/questions/2339953/how-to-add-custom-series-labels-to-a-legend-in-rs-ggplot">Or I could just relabel my factor</a>? However, I would prefer to do it at the time of plotting.</p>