![](/img/trans.png)
[英]Plotly icreate_animations offline on Jupyter Notebook
[英]Save Plotly Offline image in Jupyter Notebook?
我有一些我正在 Jupyter Notebook 中繪制的代碼,我想要做的就是將圖像另存為 PNG,這樣我就可以在我正在做的一些工作中將其用作高 DPI 圖像:
data = [trace1, trace2]
layout = {"title": "",
"xaxis": {"title": "", },
"yaxis": {"title": ""}}
fig = go.Figure(data=data, layout=layout)
plotly.offline.iplot(fig)
我不知道如何將它保存為 PNG 文件,特別是將它保存為我的 Jupyter Notebook 文件夾中的 PNG 文件。
我已經嘗試了在這里找到的解決方案: How to save Plotly Offline graph in format png?
但我不確定將代碼放在哪里,因為我的繪圖代碼不同。 我所做的一切都以錯誤告終。 有什么建議?
通過向iplot
提供filename
參數來嘗試以下iplot
plotly.offline.iplot(fig, filename='filename.png')
從文檔
簽名:plotly.offline.iplot(figure_or_data, show_link=True, link_text='Export to plot.ly', validate=True, image=None, filename='plot_image', image_width=800, image_height=600, config=None)
還要確保筆記本右上角的Trust 按鈕顯示Trusted
。 如果不是,請單擊Not Trusted
it 以使其成功。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.