title: Draw geom_vline in discrete x axis
body: <p>I have trouble with drawing a vertical line in discrete (factor) levels in the x axis of my plot. in this solution it seems to working <a href="https://stackoverflow.com/questions/50534862/drawing-vertical-line-with-factor-levels-in-ggplot2">drawing vertical line with factor levels in ggplot2</a></p>
  
  <p>but OTH this is not working with <code>geom_tile</code>?</p>
  
  <p>Basically, to remove the white space in the geom_tile I need to convert to <code>numeric</code> x values to factor levels . But at the same time I want to draw a <code>geom_vline</code> with a numeric value.  </p>
  
  <p>here is what is the problem</p>
  
  <pre><code> df &lt;- data.frame(
    x = rep(c(2, 5, 7, 9, 12), 2),
    y = rep(c(1, 2), each = 5),
    z = factor(rep(1:5, each = 2)))
  
  
   library(ggplot2)
   ggplot(df, aes(x, y)) +
    geom_tile(aes(fill = z), colour = "grey50")+
     geom_vline(aes(xintercept=6),linetype="dashed",colour="red",size=1)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/KfpEP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KfpEP.png" alt="enter image description here"></a></p>
  
  <p>to remove white space in <code>geom_tile</code> need to convert to x to <code>factor(x)</code>
  but when I do this geom_vline disappears!</p>
  
  <p><a href="https://i.stack.imgur.com/JEdSO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JEdSO.png" alt="enter image description here"></a></p>