Plotly R: can't make custom xaxis date ranges to work
<p>This should be very simple (I think) and yet I can't get this to work for some reason. I have data like this:</p>

<pre><code>df
           x y
1 2016-08-12 1
2 2016-08-13 2
3 2016-08-14 3
4 2016-08-15 4
5 2016-08-16 5

str(df)
'data.frame':   5 obs. of  2 variables:
 $ x: Date, format: "2016-08-12" "2016-08-13" ...
 $ y: int  1 2 3 4 5
</code></pre>

<p>I am using plotly as follows, but it does not adjust the xaxis range to my specified custom values. Instead, uses the range of the data:</p>

<pre><code>library(plotly)
plot_ly(df, x = x, y = y) %&gt;% layout(xaxis = list(range = c(as.Date('2016-08-01'), as.Date('2016-08-31'))))
</code></pre>

<p>On the other hand, if I have numeric data like this:</p>

<pre><code>df
  x y
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
</code></pre>

<p>And specify a custom range like this, it works fine:</p>

<pre><code>plot_ly(df, x = x, y = y) %&gt;% layout(xaxis = list(range = c(-5, 10)))
</code></pre>

<p>What am I missing in making data ranges work?</p>