title: scatter plot for sorted data in R
body: <p>I have the following data:</p>
  
  <pre><code>subject = c("S01","S02","S03","S04","S05","S06","S07","S08","S09","S10")
  post    = c(100,80,75,120,85,90,95,90,110,100)
  pre     = c(45,60,80,75,45,60,55,50,35,40)
  data1 = as.data.frame(cbind(subject, post, pre))
  </code></pre>
  
  <p>Then I sorted the data based on the post column:</p>
  
  <pre><code>data1 = data1[order(data1$post),]
  </code></pre>
  
  <p>What I want to have in the end is a scatter plot comparing the post and pre columns, in different colors accordingly. The X axis is simply the index of the data frame, but labeled with the subject number, so the axis label will be in the order of subject number since the data frame is sorted by the post column</p>
  
  <p>If I do this:</p>
  
  <pre><code>plot(data1$post)
  </code></pre>
  
  <p>What I have is a bar chart, not even a scatter plot. Is this cause by the post column being a factor? I tried "as.numeric" for both post and pre columns, but the result is the same</p>
  
  <p>If I do this:</p>
  
  <pre><code>plot(data1$post,data1$pre)
  </code></pre>
  
  <p>I have a scatter plot, but the index goes from 1 to 20. So instead of having a comparison scatter on the same index 1 to 10, I have two scatters with index from 1-10 and 11-20.</p>
  
  <p>Any help to point out my mistakes will be greatly appreciated.</p>