我试图将 plotly 图表另存为 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)