title: Hour by step of 2 hours in the form H:M on the x axis in ggplot
body: <p>I am making a plot with ggplot:</p>
  
  <pre><code>foo$time&lt;-format(as.POSIXct(foo$Date, format="%Y-%m-%d %H:%M"), format="%H:%M")
  p&lt;-ggplot(data=foo,aes(x=time,y=rm)) + geom_point()
  
  p&lt;-p+labs(x="Hour")
  p&lt;-p+labs(y = "std")
  
  p&lt;-p+theme_bw()
  p&lt;-p+theme(axis.line = element_line(colour = "black"),
   panel.grid.major = element_blank(),
   panel.grid.minor = element_blank(),
   panel.border = element_blank(),
   panel.background = element_blank()) 
  </code></pre>
  
  <p>How to receive on x axis, labels in the form of that they hour will be ex. every two hours? I tried to: 
  <code>p+scale_x_datetime(breaks=date_breaks('2 hour'),labels=date_format('%H:%M'))</code></p>
  
  <p>but it gives me "Error: Invalid input: time_trans works with objects of class POSIXct only". </p>
  
  <p>I have a big .csv file with data. So, I cannot put it here. I have two columns and many rows. They look as:</p>
  
  <p>Date    rm</p>
  
  <p>2017-06-23 00:10    1.127</p>
  
  <p>2017-06-23 00:10    1.26339</p>
  
  <p>2017-06-23 00:20    1.12279</p>