I am generating plotly graphics and using shinyapps to publish COVID data from my country.
But when I generate the plot the default modebar button is the "zoom" function and it makes complicated its use on a smartphone:

I need the "Pan" function is the default button but I could find the solution.

Thanks in advance.
Just include:
fig <- fig %>% layout(dragmode='pan')
This will change your default activated menu option from...

... to:

Complete code:
x <- c(1:100)
random_y <- rnorm(100, mean = 0)
data <- data.frame(x, random_y)
fig <- plot_ly(data, x = ~x, y = ~random_y, type = 'scatter', mode = 'lines')
fig <- fig %>% layout(dragmode='pan')
fig
I hope this is what you were looking for! Don't hesitate to let me know if not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With