Controlling the size of the HTML file when saving file

Viewed 2176

can someone help me to resize an HTML file produce with plotly in Jupyter? This is the code I am using to save to an HTML file:

    fig.write_html("D:\jupyter\image.html")

It works but now I want to control for the size. Here (https://plotly.com/python/interactive-html-export/) is suggested how to do it but I cannot get my head around to how specifically write the code to not get a big image

1 Answers

If you type fig.write_html? inside a cell you can read all the documentation, which is a little more explicit than the document you posted. In short

fig.write_html("output.html",
               include_plotlyjs="cdn")

Should produce a file ~3MB smaller than the one you are getting now as this option point to the plotly.js online instead of include it on the output.

Related