title: How do I scale an axis for time intervals using ggplot2?
body: <p>Say I want to plot a histogram of a bunch of time intervals:</p>
  
  <pre><code>library(ggplot2)
  library(dplyr)
  
  # Generate 1000 random time difftime values
  set.seed(919)
  center &lt;- as.POSIXct(as.Date("2014-12-18"))
  df &lt;- data.frame(
      center, 
      noise = center + rnorm(1000, mean = 86400, sd = 86400 * 3)
      ) %&gt;%
    mutate(diff = center - noise)
  
  # Plot histogram of the difftime values -- 
  # coerce to numeric, because otherwise it won't plot
  qplot(data = df, x = as.numeric(diff), geom = "histogram")
  </code></pre>
  
  <p>I get this plot:</p>
  
  <p><a href="https://i.stack.imgur.com/JH0CY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JH0CY.png" alt="histogram"></a></p>
  
  <p>Is there a way to change the x-axis to be reasonable date-time values?  (That is, I'd want 86400 to be labelled as "1 day", -86400 to be labelled as "- 1 day", etc.)  I could do this manually by setting breaks and labels, but I'm hoping that ggplot has a way to handle difftime values automatically.</p>