Exploring the different ways of converting figures
The methods that control converting figures start with either to_
or write_
. Let's explore some of the most interesting ones.
Converting figures into HTML
Plotly figures are actually HTML objects, together with the JavaScript that makes them interactive. We can easily capture that HTML file if we want to share it with others via email, for example. You might consider having this as a feature in your dashboards. Your users can create the chart or report they want, convert it into HTML, download it, and share it with their colleagues.
All you have to do is provide a file path of where you want it to be saved. The method also takes several optional parameters for further customization. Let's convert our figure into HTML and add a config
option to make it download the figure image in SVG format. The effect of this will be reflected in the HTML file when clicking on the camera icon. The code for this is straightforward...