title: geom_line() only uses default red and blue colors instead of assigned colors in R ggplot function
body: <p>I'm using <code>ggplot()</code> to build two scatter plots that plot health assessment score for (1) male and (2) female patients vs. # weeks in treatment, plus I'm using <code>geom_line()</code> to plot regression line overlays for both the males and females on each graph.</p>
  
  <p><strong>My question:</strong> How do I match the colors of the line overlays with the colors of the scatter plot points ('steelblue2' and 'pink3') while still retaining the legend?</p>
  
  <p>I've found if I move <code>color</code> outside of the <code>aes()</code> argument in <code>geom_line()</code>, the colors of the lines and scatterplot points match, but then the legend disappears.</p>
  
  <p>My code &amp; a sample from my data:</p>
  
  <pre><code>mean_behav_by_numweeks = data.frame(
    numweeks_round = c(1:10), 
    Mean_Behavior_Score_Male = c(3.32,4.18,3.82,4.06,3.33, 3.80,3.64,3.66,3.37,3.82), 
    nrow_male = c(396,323,293,259,226,217,202,190,170,167), 
    lm_results_predict_male = c(3.82,3.80,3.78,3.76,3.74, 3.72,3.70,3.68,3.66,3.64), 
    Mean_Behavior_Score_Female = c(2.91,3.79,3.65,3.41, 2.88,2.88,3.78,2.98,3.67,3.93), 
    nrow_female = c(109,82,72,74,66,60,58,56,52,50),
    lm_results_predict_female=c(3.44,3.44,3.45,3.45, 3.46,3.47,3.47,3.48,3.48,3.49))
  
  gg_plot1 &lt;- ggplot(mean_behav_by_numweeks, 
                     aes(numweeks_round, 
                         Mean_Behavior_Score_Male, 
                         size = mean_behav_by_numweeks$nrow_male)) + 
    geom_point(colour='steelblue2') +
    ggtitle(paste("Scatter plot of mean behavior assessment score by member by # weeks \n since 1st assessment for", 
                  as.character(var), 
                  "among Male Medi-Cal plan members")) + 
    theme(plot.title = element_text(size=10.9, hjust = 0.5)) + 
    theme(axis.text = element_text(size=8)) + 
    scale_size_continuous(range = c(1, 7)) +
    xlab("Number of weeks since 1st assessment") + 
    ylab("Mean behavior assessment score") + 
    theme(legend.position="bottom") + 
    labs(size="# members") +
    geom_line(data=mean_behav_by_numweeks, 
              aes(numweeks_round, lm_results_predict_male, color='steelblue2'), 
              size=1) +
    geom_line(data=mean_behav_by_numweeks, 
              aes(numweeks_round, lm_results_predict_female, color='pink3'), 
              size=1) +
    scale_color_discrete(name = "GenderCode", labels = c("Female", "Male")) + 
    theme(legend.position="bottom") + 
    guides(color = guide_legend(order=1, direction="vertical"))
  
  gg_plot1
  
  
  gg_plot2 &lt;- ggplot(mean_behav_by_numweeks, 
                     aes(numweeks_round, 
                         Mean_Behavior_Score_Female, 
                         size = mean_behav_by_numweeks$nrow_female)) + 
    geom_point(colour='pink3') +
    ggtitle(paste("Scatter plot of mean behavior assessment score by member by # weeks \n since 1st assessment for", 
                  as.character(var), 
                  "among Female Medi-Cal plan members")) + 
    theme(plot.title = element_text(size=10.9, hjust = 0.5)) + 
    theme(axis.text = element_text(size=8)) + 
    scale_size_continuous(range = c(1, 7)) +
    xlab("Number of weeks since 1st assessment") + 
    ylab("Mean behavior assessment score") + 
    theme(legend.position="bottom") + 
    labs(size="# members") +
    geom_line(data=mean_behav_by_numweeks, 
              aes(numweeks_round, lm_results_predict_male, color='steelblue2'), 
              size=1) +
    geom_line(data=mean_behav_by_numweeks, 
              aes(numweeks_round, lm_results_predict_female, color='pink3'), size=1) +
    scale_color_discrete(name = "GenderCode", labels = c("Female", "Male")) + 
    theme(legend.position="bottom") + 
    guides(color = guide_legend(order=1, direction="vertical"))
  
  windows()
  gg_plot2
  </code></pre>