0

I stumbled upon a need where I need to save an interactive figure which is plotted in Python by using plotly.

After hours of googling and whatnot, I found 2 solutions given in the plotly documentation to save a figure: 1. Static Image Export 2. Interactive HTML Export in Python

Interactive HTML Export fulfilled my need but left me wondering can't I use other interactive image formats i.e gif etc.

Please use the below code to find ways of saving this figure other than .html.

df = px.data.gapminder()
fig = px.scatter_geo(df, locations="iso_alpha", color="continent",
                     hover_name="country", size="pop",
                     animation_frame="year",
                     projection="natural earth")
fig.show() # Used for showing output in jupyter notebook
fig.write_html('output.html') # actually used for exporting as an .html file

Thank you in advance.

Arpit-Gole
  • 365
  • 2
  • 6
  • Gif isn’t interactive. Everybody can run HTML and javascript, and so it is an almost universal solution. – Wayne Mar 14 '20 at 14:08
  • Say you have to give presentation, you are preparing a ppt for demonstration or you want to upload it as a video on some site. What to do in these case ? – Arpit-Gole Mar 16 '20 at 01:42
  • Oh, sharing it is a different thing than your stated question. There are a lot of general screen capture utilities. [Giphy](https://giphy.com/) or [screentogif](https://www.screentogif.com/) are some popular ones I've seen. Instead of a ppt for a demonstration, I'd suggest sharing the notebook itself in active form. Maybe with toy data if you must. Then you can provide direction to how to add real data. I have a some routes outlined [here](https://stackoverflow.com/a/60660220/8508004), [here](https://stackoverflow.com/a/60661862/8508004), & [here](https://stackoverflow.com/a/60342318/8508004). – Wayne Mar 16 '20 at 14:08

0 Answers0