简体   繁体   English

图片plotly到HTML在Python

[英]Image plotly to HTML in Python

I can plot the graph.我可以 plot 该图。 My code is like this:我的代码是这样的:

plt.savefig('test3.png')
fig.write_html("test3.html")

AttributeError: 'Figure' object has no attribute 'write_html AttributeError: 'Figure' object 没有属性 'write_html

I need to convert the image to html and then put it in my email.我需要将图像转换为html,然后将其放入我的email中。

I was hoping to save the image and then convert it to html, as I am developing an automatic email in python and the idea is to use the graphic and place it in the email.我希望保存图像,然后将其转换为 html,因为我正在 python 中开发自动 email,我的想法是使用图形并将其放置在 email 中。

According to the docs , it should be done like this:根据文档,应该这样做:

plotly.io.write_html(fig, "test3.html")

I have not tested it, but I think it should work.我没有测试过它,但我认为它应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM