title: Create a year over year plot with a month x-axis via scale_x_date() with ggplot2
body: <p>Consider the following data:</p>
  
  <pre><code>library(ggplot2)
  library(lubridate)
  
  date &lt;- seq.Date(ymd("2015-01-01"), Sys.Date(), by = "day")
  
  df &lt;- data.frame(date = date,
                   value = seq_along(date) + rnorm(length(date), sd = 100))
  
  # Add yday and year
  df$yday &lt;- yday(df$date)
  df$year &lt;- year(df$date)
  
  head(df)
  #         date value yday year
  # 1 2015-01-01    97    1 2015
  # 2 2015-01-02    89    2 2015
  # 3 2015-01-03    68    3 2015
  # 4 2015-01-04    57    4 2015
  # 5 2015-01-05    70    5 2015
  # 6 2015-01-06   100    6 2016
  </code></pre>
  
  <p>I would like to make a "year over year" plot with color assigned to year. I can do this with the following:</p>
  
  <pre><code>ggplot(df, aes(x = yday, y = value, color = factor(year))) +
    geom_line()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/5ecww.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5ecww.png" alt="Plot"></a></p>
  
  <p>But this results in the x-axis being "day of the year" rather than month labels. Adding <code>+ scale_x_date()</code> fails because <code>yday</code> is no longer a date.</p>
  
  <p><strong>Is is possible to use <code>scale_x_date()</code>?</strong></p>
  
  <p>At the end of the day, I would like to do something like this: </p>
  
  <pre><code>ggplot(df, aes(x = date, y = value, color = factor(year))) +
    geom_line() +
    scale_x_date(date_labels = "%b")
  </code></pre>
  
  <p>But keep the years "stacked" on the same plot.</p>