R Plotly:如何更改默认模式栏按钮?

R Plotly:如何更改默认模式栏按钮?,r,plotly,config,R,Plotly,Config,我正在生成绘图,并使用shinyapps发布我国的新冠疫情数据 但是当我生成绘图时,默认的模式栏按钮是“缩放”功能,这使得它在智能手机上的使用变得复杂了: 我需要“平移”功能是默认按钮,但我可以找到解决方案 提前感谢。只需包括: fig <- fig %>% layout(dragmode='pan') fig%布局(dragmode='pan') 这将更改您的默认激活菜单选项,从 。。。致: 完整代码: x <- c(1:100) random_y <- r

我正在生成绘图,并使用shinyapps发布我国的新冠疫情数据

但是当我生成绘图时,默认的模式栏按钮是“缩放”功能,这使得它在智能手机上的使用变得复杂了

我需要“平移”功能是默认按钮,但我可以找到解决方案

提前感谢。

只需包括:

fig <- fig %>% layout(dragmode='pan')
fig%布局(dragmode='pan')
这将更改您的默认激活菜单选项,从

。。。致:

完整代码:

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
x