title: Remove 'duplicate' element from ggplot2 legend in R
body: <p><em>[Edited to have runnable code and with second approach]</em></p>
  
  <p>I've found several links that <em>seem</em> relevant <a href="https://stackoverflow.com/questions/13558619/theme-elements-in-ggplot2-figure">here</a>, <a href="https://stackoverflow.com/questions/15704934/remove-certain-legend-variables-and-legend-values-from-ggplot2">here</a> and <a href="https://stackoverflow.com/questions/5423105/how-to-remove-an-aesthetic-from-a-ggplot2-legend">here</a> but can't see my way straight to figuring out how to apply them to my challenge: I have a line plot created with ggplot2 that draws on a data frame including upper and lower confidence intervals. I want them to simply show in the legend as "99% CIs", not separately as, say, "Upper CI" and "Lower CI".</p>
  
  <pre><code>library(ggplot2)
  library(reshape2)
  
  gmm   &lt;- data.frame(x=runif(10), observed=runif(10), theoretical=runif(10), 
                  upper=runif(10), lower=runif(10))
  gmm.m &lt;- melt(gmm, id="x")
  
  p1 &lt;- ggplot(data=gmm.m, aes(x, value, colour=variable)) + geom_line() 
  
  p1 &lt;- p1 + scale_colour_manual(
          values=c("black", "#F8766D", "#7DAF01", "#7DAF01"), 
          labels=c("Observed","Theoretical","99% Confidence Intervals",""))
  </code></pre>
  
  <p>Setting the last legend label to the empty "" is as close as I've come to sorting this out. So just to be clear, I want both CIs to show in the same colour on the line plot, I just don't want them to show up as separate legend items.</p>
  
  <p>I <em>suspect</em> that one way to do it is to melt the <em>other</em> variables while skipping 'lower', and to then add this afterwards. But, aside from (personally) finding that approach inelegant (easier to say "add everything but hide legend for this one"), my attempts to do that have also failed.</p>
  
  <pre><code>library(ggplot2)
  library(reshape2)
  gmm   &lt;- data.frame(x=runif(10), observed=runif(10), theoretical=runif(10), upper=runif(10))
  gmm.m &lt;- melt(gmm, id="x")
  gmm.b &lt;- data.frame(x=runif(10),variable='lower', value=runif(10))
  p1 &lt;- ggplot(data=gmm.m, aes(x, value, colour=variable)) + geom_line() + scale_colour_manual(values=c("black", "#F8766D", "#7DAF01"), labels=c("Observed","Theoretical","99% Confidence Intervals",""))
  p1 &lt;- p1 + geom_line(data=gmm.b, aes(x=x, y=value, legend=FALSE))
  plot(p1)
  </code></pre>