I have a time series I'm plotting in R using ggplotly to auto-convert my ggplot2 graph plotly. My time series goes back 20 years, but when it's brought up I only want it to display the most recent 4 years of data. I've used
layout(ggplotly_object, xaxis=list(range=c(min_date,max_date)))
This does not appear to even be working to limit the date ranges, which I'm setting using lubridate to subtract 4 years from the maximum date.
I have not found any documentation on changing the default zoom of a plotly plot to a limited range of data while still allowing the user to zoom out and pan to past data. Any tips would be appreciated