I have two plotly figures converted to json, I am passing them into an HTML template, and then rendering this template in browser:
fig1_json = fig1.to_json()
fig2_json = fig2.to_json()
with tempfile.NamedTemporaryFile('w', delete=False, suffix='.html') as f:
url = 'file://' + f.name
f.write(template.format(fig1_json,fig2_json))
webbrowser.open(url)
template = """<html>
<head>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id='divPlotly' style="margin: 20px"></div>
<div id='divPlotly2' style="overflow-x: auto; margin: 0px 25px;" ></div>
<script>
var plotly_3d = {0}
Plotly.react('divPlotly', plotly_3d.data, plotly_3d.layout);
var plotly_table = {1}
Plotly.react('divPlotly2', plotly_table.data, plotly_table.layout);
</script>
</body>
</html>"""
This works fine but I want to set a config option {โstaticPlotโ: true} on the table figure, I tried in template:
Plotly.setPlotConfig = ({"staticPlot": true});
or
plotly_table.config = ({"staticPlot": true});
or
Plotly.react('divPlotly2', plotly_table.data, plotly_table.layout, {"staticPlot": true} )
but this doesnโt work. I am getting an error KeyError: โโstaticPlotโโ. How can set the config option in this situation? Thanks