Rangeselector buttons with plot_ly vs ggplotly?

The rangeselector option for plotly is a great new add. However, I am curious on the following:

  1. It seems the rangeselector buttons work fine when converting a data frame via plot_ly and then adding the layout to add the select as is done here: https://plot.ly/r/range-sliders-selectors/. Does this not work the same way if I am using ggplotly? Here is a minimal example:

library(plotly)
library(quantmod)
getSymbols(Symbols = c(“AAPL”, “MSFT”))
ds <- data.frame(Date = index(AAPL), AAPL[,6], MSFT[,6])
pg <- ggplot(data = ds,aes(Date,AAPL.Adjusted)) + geom_line()
pg_ggplotly <- ggplotly(pg)

pg_ggplotly %>%
layout(
title = “Stock Prices”,
xaxis = list(
rangeselector = list(
buttons = list(
list(
count = 3,
label = “3 mo”,
step = “month”,
stepmode = “backward”),
list(
count = 6,
label = “6 mo”,
step = “month”,
stepmode = “backward”),
list(
count = 1,
label = “1 yr”,
step = “year”,
stepmode = “backward”),
list(
count = 1,
label = “YTD”,
step = “year”,
stepmode = “todate”),
list(step = “all”))),

  rangeslider = list(type = "date")),

yaxis = list(title = "Price"))

Resulting Chart does not have the BUTTONS:

I have a ggplot graph with 2 Y Axes and I also have lines and marker traces. Is it possible to add a RangeSelector or am I forced to use plot_ly.

Thanks,

Ahsan