I’m working on a python web app which displays a plotly figure. If I call figure.show(config=config) this will open a new window, and not update the config of the figure that I have in the UI (I guess the case would be the same for a Dash app).
I’ve seen examples of some parts of config that can be updated using, e.g. update_layout(), but I want to change the ‘toImageButtonOptions’ config, and I’ve not been able to find a way to do that. The end goal is to increase the resolution of the png image that a user can download using the camera icon on the modebar.
Example
import plotly.graph_objects as go
fig = go.Figure()
fig.add_scatter(x=[1, 2, 3], y=[4, 5, 6])
# config to increase the resolution of the exported png
config = {
'toImageButtonOptions': {
'format': 'png',
'filename': 'export_name',
'height': 900,
'scale': 6
}
}
# How to update the config for the figure, without calling fig.show(config=config)