Customize icons for modebar buttons (but keep everything else)
I'd like to customize the icons for the modebar buttons while retaining their functionality.
For example: https://codepen.io/SeanBlum/pen/OJVjwgd
I can imagine two ways of doing this:
-
Expose the plotly modebar callback functions in
plotly.js/src/components/modebar/buttons.jsso that we can call them ourselves from theclickcallback. This approach has a bonus of allowing the developer to add side-effects when a standard modebar button is clicked. -
Create a
modeBarButtonsToReplaceoption that allows the user to update specific values of plotly button objects while retaining their other values, as suggested by @etpinard in https://github.com/plotly/plotly.js/issues/4036
I agree that this would be helpful, or at least the ability to just override the icon during initialization. For example setting the config options like this.
Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv', function(err, rows){
function unpack(rows, key) {
return rows.map(function(row) { return row[key]; });
}
var z_data=[ ]
for(i=0;i<24;i++)
{
z_data.push(unpack(rows,i));
}
var data = [{
z: z_data,
type: 'surface'
}];
var layout = {
title: 'Mt Bruno Elevation',
autosize: false,
width: 500,
height: 500,
margin: {
l: 65,
r: 50,
b: 65,
t: 90,
}
};
var config = {modeBarButtonsToRemove: ['resetCameraDefault3d'],modeBarButtons:{resetCameraLastSave3d :{icon:Plotly.Icons.home}}};
Plotly.newPlot('myDiv', data, layout, config);
});
This would also be useful for me, wherein I am creating some custom modebar buttons but utilizing some standard plotly ones and would like to modify the icons on the plotly default modebar buttons to be more in line with my companies overall UI.
This can be useful for me too. There's a temporary work around to replace default icons keeping their functionalities ?
Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson