Rangeslider is not aligned with plot

Hi,

I’ve got a problem with rangeslider in R API.
When using with custom dropdowns, the rangeslider is not aligned with the plot area.
Please look at the picture.

Do anyone have an advice how to solve it?

Here is how I create my widget:

p_widget <- (p %>%

layout(
  title = "",
  xaxis = list(
    rangeselector = list(),
    rangeslider   = list(type = "date")
  ),
  updatemenus = list(
    list( buttons = buttons_list )
    ),
  
  yaxis = list(title = "Space, Mb"))
)

Thanks in advance,
Andrey.

Hey @kolfild26,

You can set the domain on the axes and better control where the updatemenu / dropdown is situated. Something like:

library(plotly)

today <- Sys.Date()
tm <- seq(0, 600, by = 10)
x <- today - tm
y <- rnorm(length(x))


p <- plot_ly(
  x = ~x, 
  y = ~y, 
  type = 'scatter',
  mode = 'lines', 
  text = paste(tm, "days from today")) %>%
  rangeslider() %>%
  layout(
    title = 'Something',
    xaxis = list(domain = c(0,1)),
    yaxis = list(domain = c(0,0.9)),
    updatemenus = list(
      
      list(
        x = 0.05,
        y = 1,
        direction = "right",
        buttons = list(
          list(method = "restyle",
               args = list("line.color", "blue"),
               label = "Blue"),
          
          list(method = "restyle",
               args = list("line.color", "red"),
               label = "Red")))
    )
  )
1 Like

Thank you!

I shifted the dropdown through the updatemenus arguments and it became all right.

Andrey.