title: Remove "group" legend in ggplot
body: <p>So a handful of posts already address how to remove unwanted legends in ggplot. </p>
  
  <p>The <a href="https://stackoverflow.com/a/11714990/4581200">wonderful answer</a> posted to <a href="https://stackoverflow.com/q/11714951/4581200">"Remove extra legends in ggplot2"
  </a> suggests:</p>
  
  <blockquote>
    <p>For any mapped variable you can supress the appearance of a legend by using <code>guide = 'none'</code> in the appropriate <code>scale_</code>...</p>
  </blockquote>
  
  <p>However, I'm having problems with <strong>unwanted legends being created by adding the <code>group</code> aesthetic</strong>. 
  I tried the scale approach, but it  doesn't seem to work with the group argument: </p>
  
  <pre><code>could not find function "scale_group" 
  </code></pre>
  
  <p>A search <a href="http://ggplot2.tidyverse.org/reference/" rel="nofollow noreferrer">here</a> didn't provide any insight on the proper function call to modify group aesthetics either.</p>
  
  <p>User @joran <a href="https://stackoverflow.com/questions/11714951/remove-extra-legends-in-ggplot2/11714990#comment88037663_11714990">provided</a> the following insight in the linked post above:</p>
  
  <blockquote>
    <p>That's because the <code>group</code> aesthetic doesn't generate any scales or guides on its own. It's always sort of modifying something else. You'll never get a legend for the <code>group</code> aesthetic.</p>
  </blockquote>
  
  <hr>
  
  <p><strong>Example</strong></p>
  
  <p>So I could just add <code>show.legend = FALSE</code> to my function call containing <code>group</code> to remove any legend for that function, but this doesn't work out if I want some <em>other</em> portion (i.e., aesthetic) of that call to be included in the legend. </p>
  
  <pre><code>#Set Up Example:
  
  library(lme4)
  library(ggplot2)
  
  mod &lt;- lmer(mpg ~ hp + (1 |cyl), data = mtcars)
  pred &lt;- predict(mod,re.form = NA)
  pdat &lt;- data.frame(mtcars[,c('hp','cyl')], mpg = pred, up = pred+1, low = pred-1)
  </code></pre>
  
  <p>Adding <code>show.legend = F</code> to function calls work as expected:</p>
  
  <pre><code>gp &lt;- 
    ggplot(data = mtcars, aes(x = hp, y = mpg, color = cyl, group = cyl), show.legend = F) +
    geom_point(aes(group = cyl),show.legend = F) +
    facet_wrap(~cyl) + 
    geom_line(data = pdat, aes(group = cyl),show.legend = F, color = 'orange')
  </code></pre>
  
  <p>But when I want to add a legend for a <code>geom_ribbon</code> fill based on the same <code>group</code> (and therefore <em>cannot</em> use the <code>show.legend = F</code> argument), I get a legend for my <code>group</code> again...</p>
  
  <pre><code>gp + geom_ribbon(data = pdat, aes(ymin = low, ymax = up, group = cyl, fill = 'mod'), alpha = 0.3) + 
  scale_fill_manual(values=c("orange"), name="model")
  </code></pre>
  
  <p><strong>The outputs:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/o1Zis.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o1Zis.png" alt="enter image description here"></a></p>