title: Plotting discrete dates in boxplot x axis
body: <p>I'm trying to do a candle plot using ggplot2 on financial data.</p>
  
  <p>I use the rgdax library to retrieve crypto currencies data.</p>
  
  <pre><code>require(ggplot2)
  require(rgdax)
  require(quantmod)
  
  candles &lt;- public_candles(product_id = "ETH-EUR")
  candles$candleLower &lt;- pmin(candles$open, candles$close)
  candles$candleMiddle &lt;- NA
  candles$candleUpper &lt;- pmax(candles$open, candles$close)
  candles$fill &lt;- ''
  candles$fill[candles$open &lt; candles$close] = 'green'
  candles$fill[candles$fill ==''] = 'red'
  
  #Add Moving Averages
  candles$ma200 &lt;- SMA(candles$close, 200)
  candles$ma50 &lt;- SMA(candles$close, 50)
  
  #Graphing Step
  g &lt;- ggplot(candles, aes(x=time, lower=candleLower, middle=candleMiddle, upper=candleUpper, ymin=low, ymax=high))
  g &lt;- g + geom_boxplot(stat='identity', aes(group=time, fill=fill))
  g &lt;- g + geom_line(aes(x=time, y=ma50))+ geom_line(aes(x=time, y=ma200))
  g &lt;- g + scale_x_datetime()
  g
  </code></pre>
  
  <p>The problem I have is that the dates are continuous and I want them to be discrete. Thus the error message:</p>
  
  <blockquote>
    <p>Discrete value supplied to continuous scale</p>
  </blockquote>
  
  <p>I also want to keep the full time, with the hours, minutes and seconds.</p>
  
  <p>I tried using as.Date from the zoo package with scale_x_date, but I have the same error.</p>
  
  <p>Here is an extract of the data frame:</p>
  
  <pre><code>&gt; candles
                     time    low   high   open  close      volume
  281 2018-02-13 16:40:00 684.55 684.55 684.55 684.55  0.14481784
  280 2018-02-13 16:41:00 684.55 684.55 684.55 684.55  0.04325781
  279 2018-02-13 16:43:00 683.99 684.55 684.55 683.99  0.60137169
  278 2018-02-13 16:44:00 683.98 684.00 684.00 683.98  0.43150033
  277 2018-02-13 16:46:00 682.72 683.90 683.90 682.72  1.73803500
  276 2018-02-13 16:47:00 682.51 682.51 682.51 682.51  0.01398156
  275 2018-02-13 16:49:00 682.51 682.51 682.51 682.51  0.28122771
  274 2018-02-13 16:50:00 683.00 683.58 683.58 683.00  1.52767648
  273 2018-02-13 16:51:00 682.99 683.00 682.99 683.00  0.29247699
  272 2018-02-13 16:52:00 683.00 683.00 683.00 683.00  0.02190716
  271 2018-02-13 16:54:00 683.00 683.58 683.00 683.58  0.50166543
  270 2018-02-13 16:56:00 683.58 683.61 683.58 683.61 11.81034652
  269 2018-02-13 16:58:00 683.98 683.99 683.99 683.98  0.44021340
  268 2018-02-13 17:01:00 684.17 684.23 684.17 684.22  0.53595431
  267 2018-02-13 17:02:00 684.37 684.37 684.37 684.37  0.48513463
  266 2018-02-13 17:03:00 684.43 684.43 684.43 684.43  0.05492116
  265 2018-02-13 17:05:00 684.43 684.43 684.43 684.43  0.11513667
  264 2018-02-13 17:06:00 684.42 684.42 684.42 684.42  1.12376641
  263 2018-02-13 17:07:00 684.43 684.43 684.43 684.43  0.57568335
  262 2018-02-13 17:08:00 684.42 684.43 684.42 684.43  0.34713259
  261 2018-02-13 17:09:00 684.42 684.42 684.42 684.42  9.89238437
  260 2018-02-13 17:10:00 684.43 684.43 684.43 684.43  0.07287131
  259 2018-02-13 17:11:00 684.43 684.48 684.43 684.48  1.19321749
  258 2018-02-13 17:12:00 684.47 684.48 684.47 684.47  0.22166553
  257 2018-02-13 17:13:00 684.21 684.47 684.47 684.21  0.06647252
  </code></pre>
  
  <p>Here is the expected output:</p>
  
  <p><a href="https://i.stack.imgur.com/3Yp2f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Yp2f.png" alt="enter image description here"></a></p>