title: Ordering issue in ggplot2
body: <p>The data used for the plot are given below:</p>
  
  <pre><code>mdfr3 &lt;- read.table(textConnection("
  name  stadio    variable    value   rating
  541B    2   start_date  22/02/2011  5
  541B    4   start_date  24/05/2011  5
  541B    5   start_date  01/06/2011  5
  541B    7   start_date  20/09/2011  5
  579B    2   start_date  07/06/2011  5
  579B    4   start_date  08/02/2012  5
  579B    5   start_date  09/02/2012  5
  579B    7   start_date  24/04/2012  5
  700B    2   start_date  29/02/2012  5
  700B    4   start_date  29/02/2012  5
  700B    5   start_date  29/02/2012  5
  700B    7   start_date  08/05/2012  5
  719B    2   start_date  29/06/2012  5
  719B    4   start_date  10/07/2012  5
  719B    5   start_date  19/07/2012  5
  719B    7   start_date  16/10/2012  5
  737B    2   start_date  22/06/2012  5
  737B    4   start_date  25/07/2012  5
  737B    5   start_date  01/08/2012  5
  737B    7   start_date  23/10/2012  5
  635B    2   start_date  03/05/2012  5
  635B    4   start_date  29/06/2012  5
  635B    5   start_date  05/07/2012  5
  635B    7   start_date  11/09/2012  5
  558B    2   start_date  30/05/2011  5
  558B    4   start_date  17/10/2011  5
  558B    5   start_date  27/01/2012  5
  558B    7   start_date  06/04/2012  5
  734B    2   start_date  16/03/2012  5
  734B    4   start_date  16/03/2012  5
  734B    5   start_date  16/03/2012  5
  734B    7   start_date  25/04/2012  5
  727B    2   start_date  23/12/2011  5
  727B    4   start_date  03/02/2012  5
  727B    5   start_date  16/02/2012  5
  727B    7   start_date  18/05/2012  5
  725B    2   start_date  28/12/2011  5
  725B    4   start_date  23/02/2012  5
  725B    5   start_date  02/03/2012  5
  725B    7   start_date  31/05/2012  5
  733B    2   start_date  30/12/2011  5
  733B    4   start_date  23/02/2012  5
  733B    5   start_date  02/03/2012  5
  733B    7   start_date  07/06/2012  5
  541B    2   end_date    24/05/2011  5
  541B    4   end_date    01/06/2011  5
  541B    5   end_date    20/09/2011  5
  541B    7   end_date    28/09/2012  5
  579B    2   end_date    08/02/2012  5
  579B    4   end_date    09/02/2012  5
  579B    5   end_date    24/04/2012  5
  579B    7   end_date    29/10/2012  5
  700B    2   end_date    29/02/2012  5
  700B    4   end_date    29/02/2012  5
  700B    5   end_date    08/05/2012  5
  700B    7   end_date    12/11/2012  5
  719B    2   end_date    10/07/2012  5
  719B    4   end_date    19/07/2012  5
  719B    5   end_date    16/10/2012  5
  719B    7   end_date    28/02/2013  5
  737B    2   end_date    25/07/2012  5
  737B    4   end_date    01/08/2012  5
  737B    5   end_date    23/10/2012  5
  737B    7   end_date    28/02/2013  5
  635B    2   end_date    29/06/2012  5
  635B    4   end_date    05/07/2012  5
  635B    5   end_date    11/09/2012  5
  635B    7   end_date    04/02/2013  5
  558B    2   end_date    17/10/2011  5
  558B    4   end_date    27/01/2012  5
  558B    5   end_date    06/04/2012  5
  558B    7   end_date    09/09/2012  5
  734B    2   end_date    16/03/2012  5
  734B    4   end_date    16/03/2012  5
  734B    5   end_date    25/04/2012  5
  734B    7   end_date    04/07/2012  5
  727B    2   end_date    03/02/2012  5
  727B    4   end_date    16/02/2012  5
  727B    5   end_date    18/05/2012  5
  727B    7   end_date    19/11/2012  5
  725B    2   end_date    23/02/2012  5
  725B    4   end_date    02/03/2012  5
  725B    5   end_date    31/05/2012  5
  725B    7   end_date    30/11/2012  5
  733B    2   end_date    23/02/2012  5
  733B    4   end_date    02/03/2012  5
  733B    5   end_date    07/06/2012  5
  733B    7   end_date    30/11/2012  5
  ")-&gt;con,header=T);close(con)
  
  
  mdfr4 &lt;- read.table(textConnection("
  name    stadio  variable    value   rating
  541A    1   start_date  22/02/2011  3
  541A    3   start_date  24/05/2011  3
  541A    6   start_date  01/06/2011  3
  541A    8   start_date  20/09/2011  3
  579A    1   start_date  07/06/2011  3
  579A    3   start_date  08/02/2012  3
  579A    6   start_date  09/02/2012  3
  579A    8   start_date  08/05/2012  3
  700A    1   start_date  22/03/2012  3
  700A    3   start_date  22/03/2012  3
  700A    6   start_date  22/03/2012  3
  700A    8   start_date  12/06/2012  3
  719A    1   start_date  10/07/2012  3
  719A    3   start_date  17/07/2012  3
  719A    6   start_date  26/07/2012  3
  719A    8   start_date  09/10/2012  3
  737A    1   start_date  01/07/2012  3
  737A    3   start_date  06/07/2012  3
  737A    6   start_date  26/07/2012  3
  737A    8   start_date  16/10/2012  3
  635A    1   start_date  03/05/2012  3
  635A    3   start_date  31/07/2012  3
  635A    6   start_date  31/07/2012  3
  635A    8   start_date  23/10/2012  3
  558A    1   start_date  30/05/2011  3
  558A    3   start_date  17/10/2011  3
  558A    6   start_date  27/01/2012  3
  558A    8   start_date  06/04/2012  3
  734A    1   start_date  16/03/2012  3
  734A    3   start_date  16/03/2012  3
  734A    6   start_date  16/03/2012  3
  734A    8   start_date  25/04/2012  3
  727A    1   start_date  23/12/2011  3
  727A    3   start_date  03/02/2012  3
  727A    6   start_date  16/02/2012  3
  727A    8   start_date  18/05/2012  3
  725A    1   start_date  28/12/2011  3
  725A    3   start_date  23/02/2012  3
  725A    6   start_date  02/03/2012  3
  725A    8   start_date  31/05/2012  3
  733A    1   start_date  30/12/2011  3
  733A    3   start_date  23/02/2012  3
  733A    6   start_date  02/03/2012  3
  733A    8   start_date  07/06/2012  3
  541A    1   end_date    24/05/2011  3
  541A    3   end_date    01/06/2011  3
  541A    6   end_date    20/09/2011  3
  541A    8   end_date    17/01/2013  3
  579A    1   end_date    08/02/2012  3
  579A    3   end_date    09/02/2012  3
  579A    6   end_date    08/05/2012  3
  579A    8   end_date    19/12/2012  3
  700A    1   end_date    22/03/2012  3
  700A    3   end_date    22/03/2012  3
  700A    6   end_date    12/06/2012  3
  700A    8   end_date    18/12/2012  3
  719A    1   end_date    17/07/2012  3
  719A    3   end_date    26/07/2012  3
  719A    6   end_date    09/10/2012  3
  719A    8   end_date    21/12/2012  3
  737A    1   end_date    06/07/2012  3
  737A    3   end_date    26/07/2012  3
  737A    6   end_date    16/10/2012  3
  737A    8   end_date    28/12/2012  3
  635A    1   end_date    31/07/2012  3
  635A    3   end_date    31/07/2012  3
  635A    6   end_date    23/10/2012  3
  635A    8   end_date    22/03/2013  3
  558A    1   end_date    17/10/2011  3
  558A    3   end_date    27/01/2012  3
  558A    6   end_date    06/04/2012  3
  558A    8   end_date    10/01/2013  3
  734A    1   end_date    16/03/2012  3
  734A    3   end_date    16/03/2012  3
  734A    6   end_date    25/04/2012  3
  734A    8   end_date    20/09/2012  3
  727A    1   end_date    03/02/2012  3
  727A    3   end_date    16/02/2012  3
  727A    6   end_date    18/05/2012  3
  727A    8   end_date    19/11/2012  3
  725A    1   end_date    23/02/2012  3
  725A    3   end_date    02/03/2012  3
  725A    6   end_date    31/05/2012  3
  725A    8   end_date    30/11/2012  3
  733A    1   end_date    23/02/2012  3
  733A    3   end_date    02/03/2012  3
  733A    6   end_date    07/06/2012  3
  733A    8   end_date    30/11/2012  3
  ")-&gt;con,header=T);close(con)
  
  mdfr3$name &lt;- factor(mdfr3$name,levels(factor(mdfr3$name))[c(1,3,5,6,11,4,2,10,8,7,9)])
  mdfr3$rating &lt;- factor(mdfr3$rating)
  mdfr4$name &lt;- factor(mdfr4$name,levels(factor(mdfr4$name))[c(1,3,5,6,11,4,2,10,8,7,9)])
  mdfr4$rating &lt;- factor(mdfr4$rating)
  </code></pre>
  
  <p>The <code>p</code> plot shows the values on the y axis sorted exactly how I want them to be.</p>
  
  <pre><code>p &lt;- ggplot(mdfr3, aes(as.Date(value, "%d/%m/%Y"), name, colour = factor(stadio))) +
    geom_line(size = 5) +
    scale_size_manual(breaks = c("3","5"),  values = c(3,5), guide = "none") +
    labs(colour="Legend:", x = "", y = "") +
    scale_colour_brewer(palette="BrBG",breaks = c("2", "4", "5","7"),
                        labels = c("Level 1", "Level 2", "Level 3","Level 4"))
  </code></pre>
  
  <p>But when I give the following command, the ordering changes.   </p>
  
  <pre><code>  p + geom_line(data=mdfr4,aes(size = rating, colour = factor(stadio)))
  </code></pre>
  
  <p>Why does the last line changes the ordering of the labels on the y axis? How can I prevent this from happening?</p>