title: ggplot2: Change factor order in legend
body: <p>I have a a line graph and I want to reorder the way in which the factors appear in the legend. I have tried <code>scale_fill_discrete</code> but it doesn't change the order. 
  Here's a simulation of my problem:</p>
  
  <pre><code>df &lt;- data.frame(var1=c("F", "F", "F", "B", "B", "B"),
                   var2=c("levelB", "levelC", "levelA"),
                   value=c("2.487585", "2.535944", "3.444764", "2.917308", "2.954155","3.739049"))
  
  p &lt;- ggplot(data=df, aes(x=var1, y=value, 
    group=var2, colour=var2, shape = var2)) +
    geom_line(size = 0.8) +
    geom_point()+
    xlab("var1") + ylab("Value") +
    scale_x_discrete(limits=c("F","B")) + 
    theme(legend.title = element_text(size=12)) + 
    theme(legend.text = element_text(size=10)) +
    scale_fill_discrete(breaks=c("levelB","levelC","levelA")) +
    theme(title = element_text(size=12)) +
    blank + scale_color_manual(values=c("green2", "red", "black")) +
    theme(legend.key = element_blank())
  p
  </code></pre>
  
  <p>Which creates this:</p>
  
  <p><a href="https://i.stack.imgur.com/SGmSM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SGmSM.jpg" alt="enter image description here"></a></p>
  
  <p>I would like everything to remain the exactly the same, except for the legend, where I would like to change the order to <code>levelB</code> then <code>levelC</code> then <code>levelA</code>. 
  I'm guessing <code>ggplot2</code> orders the legend alphabetically and I would like to override this. 
  Reordering my data frame didn't work, and <code>scale_fill_discrete</code> also doesn't change it. 
  Any ideas? </p>
  
  <p>Thanks!</p>