title: How to move the ticks of x axis (date in years) in ggplot2?
body: <p>I want to check the boxplots for each year for variable <code>a</code> in the  <code>df data.frame</code>. I used the code below to create the <code>data.frame</code></p>
  
  <pre><code>set.seed(123)
  date &lt;- as.Date(seq(as.Date("1990-01-01"), as.Date("2015-12-31"), by = 1), format="%Y-%m-%d")
  a &lt;- runif(9496, 3000, 120000)
  df &lt;- data.frame(date, a)
  df[c(1:151,9313:9496), 2]&lt;-NA
  </code></pre>
  
  <p>and using this code</p>
  
  <pre><code>library(ggplot2)
  ggplot(df, aes(x=date, y=a, group=years(date)))+
    geom_boxplot()+
    scale_x_date(breaks = date_breaks("1 year"),
                 labels = date_format("%Y"))
  </code></pre>
  
  <p>I got this figure</p>
  
  <p><a href="https://i.stack.imgur.com/yOxeu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yOxeu.png" alt="enter image description here"></a></p>
  
  <p>The years on x axis are shown before and after the boxplot. How can I align the ticks of x axis and axis.text with the boxplots?</p>