Autorangeoptions for range of x-axis do not work


I am trying to implement autorange for my x-axis in plotly (R). However, the automatic range should never take values beyond the following range for the x axis: [2, 4]. If the user wants to see values outside of this range he should still be able to use the zoom options.

I tried to implement this using the layout.xaxis.autorangeoptions command and set values for clipmin, clipmax. Unfortunately, it does not work. The plot always takes the full range of the data. Is this a bug?

Here is a testing example:


plot_ly() %>% 
  add_trace(x = mtcars$wt, y = mtcars$qsec, type = "scatter", mode = "markers") %>% 
    xaxis = 
      list(autorange = TRUE,
           autorangeoptions = list(clipmin = 2, clipmax = 4))

Replacing clipmin with minallowed and clipmax with maxallowed did not work either.

My actual implementation is a R Shiny App in which the user can set the parameters of two normal distributions using sliders. These are then compared in a plotly graph. I generate the data (x and density) along the sequence [-500, 500]. However, the sliders are chosen so that only the area [-20, 20] is interesting. I donโ€™t want fixed ranges since users should still be able to zoom in and out (beyond the range of [-20, 20] manually.