I’m asking/answering my own question here so others can learn. If you want to hide or remove some buttons from a Plotly plot this can only be accessed on the fig.show() method like so (this removes the Plotly modebar completely):
fig.show(config=dict(displayModeBar=False))
But in Anvil figures are shown automatically! So how are we supposed to change these config items? Well there is a conveniently accessible config dict available to you. The usage of which isn’t immediately obvious. To change config options you simply update the dict as you would any other Python dict. A la:
self.plot_name.config['displayModeBar'] = False
And there you go, you can tweak your config! Keep in mind this will have to be done for each chart.
However, the given solution seems to not work when using the following approach :
Creating a plotly express figure server side, and return this figure object in the client and do the following :
fig = anvil.server.call('create_plotly_express_figure')
self.plot_component.figure = fig
# then trying to hide the modebar doesnt work
self.plot_component.config['displayModeBar'] = False
If anyone knows how to do it with plotly express … I would love to read your solution !
This one is marked as solved. To give your new question the visibility it deserves, you’re probably better off starting a new (unsolved) topic instead.