Reputation: 459
I didn't find an argument to disable the zoom mode of the mouse cursor on a plotly graph. This is bad because when you drag your fingers across your phone, the zoom increases. Taking advantage of the question, I would like to remove all the buttons from the plotly and leave only the button to download the image.
Upvotes: 6
Views: 4516
Reputation:
There is a lot you can do! The button line in plotly
is called "modebar" and you can remove it completely, or remove specific buttons from it:
plot_ly() %>%
config(modeBarButtonsToRemove = c("zoomIn2d", "zoomOut2d"))
See more details in the book Interactive web-based data visualization with R, plotly, and shiny.
(Documentation is unfortunately very brief.)
If you want not only to disable buttons, but also to disable zooming completely, use layout()
with xaxis
and yaxis
arguments to fix the axis range by fixedrange
settings (note it has to be a list):
library(plotly)
plot_ly(x = 1:10,y = 1:10) %>%
layout(xaxis = list(fixedrange = TRUE), yaxis = list(fixedrange = TRUE))
See xaxis and yaxis documentation for zooming.
Upvotes: 15