title: How to segregate by one factor but colour by another in ggplot2 R?
body: <p>In my dataset, I have segregated the data by a parameter <code>par</code> for either <code>Black</code> or <code>Red</code> noise that are staggered in represtation. Now, for both species, I want to colour the &quot;Black&quot; noise as black, and &quot;Red&quot; as red. Furthermore, I want to join the points by <code>par</code> -- specifically, I want to join <code>par</code> -- <code>No</code> with a Dashed line, and <code>Yes</code> as a solid line. I tried the piece of code attached (and multiple versions of it)..but no luck. Any suggestions?</p>
  <pre><code>#Data
  
  set.seed(100)
  sp &lt;- factor(c(&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;B&quot;,&quot;B&quot;,&quot;B&quot;,&quot;B&quot;))
  par &lt;- factor(c(&quot;No&quot;,&quot;No&quot;,&quot;Yes&quot;,&quot;Yes&quot;,&quot;No&quot;,&quot;No&quot;,&quot;Yes&quot;,&quot;Yes&quot;))
  y &lt;- rnorm(8, 2,3)
  noise &lt;- factor(c(&quot;Black&quot;,&quot;Red&quot;,&quot;Black&quot;,&quot;Red&quot;,&quot;Black&quot;,&quot;Red&quot;,&quot;Black&quot;,&quot;Red&quot;))
  
  df &lt;- data.frame(sp, par, y, noise)
  df$noise &lt;- factor(df$noise, levels = c(&quot;Black&quot;,&quot;Red&quot;))
  </code></pre>
  <p><a href="https://i.stack.imgur.com/txUWA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/txUWA.png" alt="enter image description here" /></a></p>
  <pre><code>  library(ggplot2)
      ggplot(data = df, aes(x = noise, y = y, fill = par, color = par)) +
        geom_point(size = 4) + 
        facet_wrap(.~sp) +
        theme_classic() + 
        scale_fill_manual(values = c(&quot;black&quot;,&quot;red&quot;)) +   scale_color_manual(values = c(&quot;black&quot;,&quot;red&quot;)) +  
        geom_line(aes(linetype=par)) + scale_linetype_manual(name = &quot;indicator&quot;, values = c(2,1,2))
        geom_path(aes(group = par,linetype=par), geom = &quot;path&quot;) 
        
  </code></pre>
  <p>ERROR: geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?</p>