title: How can I change the color order of lines in geom_line() in ggplot
body: <p>I'd like to change the line color in this plot so that they are in a "natural" or original <code>RColorBrewer</code> color order. This code produces the following plot:</p>
  
  <pre><code>df &lt;- data_frame(GeoName = rep(LETTERS, 3)) %&gt;% 
      arrange(GeoName) %&gt;% 
      mutate(year = rep(c(2009, 2010, 2011), 26),
             percent_change = sample(seq(-3, 3, .1), 78, T))
  
  #create my color ramp function
  YlGnBu &lt;- colorRampPalette(RColorBrewer::brewer.pal(9, 'YlGnBu'))
  
  
  df %&gt;% 
      ggplot(aes(year,
                 percent_change,
                 group = GeoName,
                 # order = GeoName,               &lt;- does not accomplish my goal
                 color = GeoName))+
      geom_point(show.legend = F)+
      geom_line(show.legend = F)+
      scale_color_manual(values = YlGnBu(n_distinct(df$GeoName)))+ # color function 
      scale_x_continuous(breaks = c(2009, 2010, 2011))+              # from above
      theme(panel.background = element_blank(),
            panel.grid = element_blank(),
            axis.line = element_line(color = 'black')) 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/BiKqZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BiKqZ.png" alt="enter image description here"></a></p>