jle123
May 29, 2019, 12:48am
1
I’ve been trying to find a way to remove Lasso Select, Box Select & Toggle Spike Line options from the Mode Bar.
I found code in the Github repo related to the modebar buttons but I don’t see any references to the three buttons mentioned above: https://github.com/plotly/plotly.js/blob/v1.3.0/src/components/modebar/buttons.js .
Does anybody know the names to use for these buttons inside the modeBarButtonsToRemove
array?
I’ll answer my own question, here’s the full list of Mode Bar button names:
“zoom2d”, “pan2d”, “select2d”, “lasso2d”, “zoomIn2d”, “zoomOut2d”, “autoScale2d”, “resetScale2d”, “hoverClosestCartesian”, “hoverCompareCartesian”, “zoom3d”, “pan3d”, “resetCameraDefault3d”, “resetCameraLastSave3d”, “hoverClosest3d”, “orbitRotation”, “tableRotation”, “zoomInGeo”, “zoomOutGeo”, “resetGeo”, “hoverClosestGeo”, “toImage”, “sendDataToCloud”, “hoverClosestGl2d”, “hoverClosestPie”, “toggleHover”, “resetViews”, “toggleSpikelines”, “resetViewMapbox”
REF: http://www.somesolvedproblems.com/2018/10/how-to-customize-plotlys-modebar.html
Alqua
May 15, 2021, 2:46pm
3
I would like to do exactly just that, remove lasso and box select from mode bar. Or lock them. box select activate while going down when browsing on a phone.
However, I did not understand the explaination on the link can I modify this while staying in R? Do I edit the plotly object afterwards? Could you explain more in details the procedure?
In R, you can remove buttons using code like the following:
plot_ly() %>%
config(modeBarButtonsToRemove = c("zoomIn2d", "zoomOut2d"))
See 26 Control the modebar | Interactive web-based data visualization with R, plotly, and shiny for more details on how to control the modebar.
rtc
August 16, 2023, 1:14pm
5
The code removed the Lasso Select and Box Select:
dcc.Graph(
config={
'modeBarButtonsToRemove': ['lasso2d', 'select2d']
}
)
v1.3.0 doesn’t show the ‘Lasso Select’ or ‘Box Select’ names but they can be found in the latest version linked below:
'use strict';
var Registry = require('../../registry');
var Plots = require('../../plots/plots');
var axisIds = require('../../plots/cartesian/axis_ids');
var Icons = require('../../fonts/ploticon');
var eraseActiveShape = require('../shapes/draw').eraseActiveShape;
var Lib = require('../../lib');
var _ = Lib._;
var modeBarButtons = module.exports = {};
/**
* ModeBar buttons configuration
*
* @param {string} name
* name / id of the buttons (for tracking)
* @param {string} title
* text that appears while hovering over the button,
* enter null, false or '' for no hover text
This file has been truncated. show original