title: ggplot2 adding custom legend when plotting two lines from subset of columns
body: <p>I've looked all over stack and other sites to fix my code but can't see what's wrong.  I am trying to plot 2 lines on the same graph on ggplot that are portions of 2 different columns. For example, I have a column of length 8 of which the first four rows are M (male) and the last four rows are F (female). I have two columns of data and one column for condition (factor).</p>
  
  <pre><code>ModelMF &lt;- data.frame(ProbGender, ProbCond, ProbMF, Act_pct)
  </code></pre>
  
  <p>where:</p>
  
  <pre><code> ProbGender   ProbCond   ProbMF   Act_pct
   M            0           .75     .71
   M            10          .67     .69
   M            20          .61     .54
   M            30          .81     .77
   F            0           .88     .82
   F            10          .73     .71
   F            20          .67     .71
   F            30          .60     .63
  </code></pre>
  
  <p>I have tried the following but I keep getting errors (see below):</p>
  
  <pre><code>ggplot(data = ModelMF, aes(x = ProbCond)) + geom_line(data =   
  ModelMF[ModelMF$ProbGender=="M",], aes(y=ProbMF), color = 'col1') + 
  geom_point(data = ModelMF[ModelMF$ProbGender=="M",], aes(y = ProbMF)) +
  geom_line(data = ModelMF[ModelMF$ProbGender=="M",], aes(y=Act_pct), color =
  'col2') + geom_point(data = ModelMF[ModelMF$ProbGender=="M",], aes(y =
  Act_pct)) + scale_color_manual(values = c('col1' = 'darkblue', 'col2' ='lightblue'))      
  </code></pre>
  
  <p>Preferably I would like to be able to create a custom legend that lets me map the colors as I've attempted to do using scale_color_manual, but I get the following error: </p>
  
  <pre><code>Error in grDevices::col2rgb(colour, TRUE) : invalid color name 'col1'
  </code></pre>
  
  <p>I'm not sure if it is due to the fact that I'm subsetting data within the df or something else I'm just missing? Also if I add the female lines I assume I can simply follow the same procedure?</p>
  
  <p>Thanks in advance.</p>