title: Formatting dates on X axis in ggplot2
body: <p>I'm having a very, very tough time getting the x-axis to look correct for my graphs.  </p>
  
  <p>Here is my data (generated via <code>dput()</code>):</p>
  
  <pre><code>df &lt;- structure(list(Month = structure(1:12, .Label = c("2011-07-31", "2011-08-31", "2011-09-30", "2011-10-31", "2011-11-30", "2011-12-31", "2012-01-31", "2012-02-29", "2012-03-31", "2012-04-30", "2012-05-31", "2012-06-30"), class = "factor"), AvgVisits = c(6.98655104580674,7.66045407330464, 7.69761337479304, 7.54387561322994, 7.24483848458728, 6.32001400498928, 6.66794871794872, 7.207780853854, 7.60281201431308, 6.70113837397123, 6.57634103019538, 6.75321935568936)), .Names = c("Month","AvgVisits"), row.names = c(NA, -12L), class = "data.frame")
  </code></pre>
  
  <p>Here is the chart I am trying to graph: </p>
  
  <pre><code>ggplot(df, aes(x = Month, y = AvgVisits)) + 
    geom_bar() +
    theme_bw() +
    labs(x = "Month", y = "Average Visits per User")
  </code></pre>
  
  <p>That chart works fine - but, if I want to adjust the formatting of the date, I believe I should add this:
  <code>scale_x_date(labels = date_format("%m-%Y"))</code></p>
  
  <p>I'm trying to make it so the date labels are 'MMM-YYYY'</p>
  
  <pre><code>ggplot(df, aes(x = Month, y = AvgVisits)) + 
    geom_bar() +
    theme_bw() +
    labs(x = "Month", y = "Average Visits per User") +
    scale_x_date(labels = date_format("%m-%Y"))
  </code></pre>
  
  <p>When I plot that, I continue to get this error:</p>
  
  <p><code>stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to adjust this.</code></p>
  
  <p>Despite hours of research on formatting of <code>geom_line</code> and <code>geom_bar</code>, I can't fix it.  Can anyone explain what I'm doing wrong? </p>
  
  <p>Edit: As a follow-up thought: Can you use date as a factor, or should you use <code>as.Date</code> on a date column?</p>