Saving images from plotly

。_饼干妹妹 提交于 2021-01-28 11:15:16

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/61780675/saving-images-from-plotly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!