无法将Plotly图表保存到HTML文件中



我试图将绘图图保存为HTML文件,但收到错误消息Access to the file was deniedThe file at file:///Users/Documents/notebooks/figure.html is not readable. It may have been removed, moved or file permissions may be preventing access.

html文件未保存。我正在使用Brave浏览器,不确定它们是否相关。

示例代码

import plotly.io as pio
import plotly.graph_objects as go
labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen']
values = [4500, 2500, 1053, 500]
fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
fig.show()
pio.write_html(fig, file='figure.html', auto_open=True)

将浏览器切换到Safari后问题得到解决。

我已经成功地将此图用于HTML,并且它适用于我尝试过的所有浏览器。诚然,我还没有尝试过"自动打开"。

fig.write_html("C:/???/???/Desktop/Port.html") 

相关内容

  • 没有找到相关文章

最新更新