Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving images from plotly

Tags:

python

plotly

How can I save images generated with plotly in different formats? Only "Download as PNG" is possible from the generated HTML figure. I would need to interact with the figure (change rotation, choose which data to plot) and save an .eps figure for each online modified plot. Thanks a lot!

like image 688
AliceGem Avatar asked Oct 18 '25 08:10

AliceGem


1 Answers

Plotly supports exporting to EPS (the docs mention that you need the poppler library) and the Figure object has a write_image method that saves a figure to a file.

You can specify the format through the filename and the resolution with the width and height keyword arguments, representing logical pixels.

You can read more on static image exporting in Plotly here. This is a code example:

fig.write_image("name.eps", width=1920, height=1080)

In order to select what is plotted you will have to set the figure's camera controls.

like image 145
Robin De Schepper Avatar answered Oct 19 '25 21:10

Robin De Schepper



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!