title: ggplot - prevent ordering of character or factor x-axis values
body: <p>Consider the following data frame being plotted as <code>geom_line</code>:</p>
  
  <pre><code>mydata &lt;- data.frame(X = c('1 Dog', '2 Dog', '3 Dog', '4 Dog', '1 Frog', '2 Frog', '1 Cat', '2 Cat'), Y = sample(1:3, 8, replace = T))
  myplot &lt;- ggplot(mydata, aes(x = X, y = Y, group = 1)) + geom_line() + theme(axis.text.x = element_text(angle = 90, hjust = 1))
  print(myplot)
  </code></pre>
  
  <p>The plot orders the x-axis by number and alphabetically. How can I prevent this, such that the graph is plotted in the order as it is in the data frame? Converting <code>X</code> to a character does not help. I cannot order the x-axis ticks manually as my original dataset has thousands of entries.  </p>