title: X axis in ggplot2: factor
body: <p>I am trying to plot two scatter lines in ggplot. The x axis is integers from 1 to 10. Initially I wrote the following code:</p>
  
  <pre><code>library(ggplot2)
  Answer &lt;- c(1:10)
  EM = c(0.458,0.517,0.4,0.394,0.15,0.15,0.0,0.2,0.14,0.33)
  F1 = c( 0.56,0.63,0.632,0.704,0.502,0.524,0.488,0.64,0.5,0.593)
  test_data &lt;- data.frame(EM,F1,Answer)
  
  ggplot(test_data, aes(Answer)) + 
    geom_line(aes(y = EM, colour = "EM")) + 
    geom_line(aes(y = F1, colour = "F1"))
  </code></pre>
  
  <p>This results in the following plot</p>
  
  <p><a href="https://i.stack.imgur.com/VVAum.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VVAum.png" alt="enter image description here"></a></p>
  
  <p>The x axis is continuous here and printing values like 2.5,7.5. To make it factor ie 1,2,3,4,...,10 I tried putting <code>aes(factor(Answer))</code> but this results in empty plot. How can I fix this? </p>