Use plotly offline to generate graphs as images(使用 plotly 离线生成图形作为图像)
问题描述
我正在离线使用 plotly 并且能够使用生成 html 文件
I am working with plotly offline and am able to generate an html file using
plotly.offline.plot({"data": data, "layout": layout})
效果很好.该图已正确生成,并且 html 文件被保存到我的当前目录中.
It works great. The graph is generated correctly and the html file gets saved to my current directory.
不过,我想要的是,使用 plotly 离线保存一个图像(.png、.jpg 等)文件.我在正确的轨道上吗?我需要从这里做什么?
What I want, though is, using plotly offline, is to have an image (.png, .jpg, etc.) file saved instead. Am I on the right track? What do I need to do from here?
推荐答案
试试这个
import plotly.offline
import plotly.graph_objs as go
plotly.offline.plot({"data": [go.Scatter(x=[1, 2, 3, 4], y=[4, 3, 2, 1])],
"layout": go.Layout(title="hello world")},
image='jpeg', image_filename='test')
在 Chrome 中打开
and open it in Chrome
这篇关于使用 plotly 离线生成图形作为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 plotly 离线生成图形作为图像


基础教程推荐
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01