title: Plotting 2 lines in R with different x axis
body: <p>I have 2 data frames x and y that I have to merge.</p>
  
  <p>Then I want to plot 2 lines:</p>
  
  <p>line 1= The "vol" that came from the x data frame
  line 2 =  the "vol" that came from the y data frame </p>
  
  <p>Both lines will should have "strike" on the x axis.</p>
  
  <p>I am running in to errors. I think it is because the x-axis is not the same.</p>
  
  <p>Can you help? </p>
  
  <p>I would really like to use ggplot.</p>
  
  <p>Here is my code that you can run:</p>
  
  <pre><code>x&lt;- data.frame(strike= c(1,2,2.5,7), term= c("H15"), Vol = c(6,7,8,9), file="a")
  x
  y&lt;- data.frame(strike= c(1,2,2.75,7), term=c("H15"), Vol = c(7,9,10,12),file="b")
  y
  main&lt;- merge(x,y, by = "strike", all= TRUE)
  main
  
  strikes&lt;- factor(main$strike,levels=c(main$strike),ordered=TRUE)
  strikes
  
  stacked &lt;- data.frame(time=strikes, value =c(c(x$Vol), c(y$Vol)) , variable =   rep(c("a","b"), each=NROW(x[,1])))  
  stacked
  
  MyPlot&lt;- ggplot(stacked, aes( x = time,  y=value, colour=variable, group= variable)  )   +   geom_line()  
  MyPlot
  </code></pre>