[英]How do I save a graph and a table to one file(PDF, JPG, PNG, etc) from Jupyter Notebook so that the table is next(on the right) to the graph?
[英]How do I save plotly graph as jpg
如何将在graph.show()
之后创建的以下图形保存为 JPG、PNG 或 PDF 到特定目录?
代码:
import plotly.graph_objects as go
graph = go.Figure(data=[go.Candlestick(x=df['Date'],
open=df['AAPL.Open'], high=df['AAPL.High'],
low=df['AAPL.Low'], close=df['AAPL.Close'])
])
graph.show()
这将起作用:
graph.write_image("name_of_file.jpeg")
但是你必须安装万花筒。 从plotly 文档中,您可以看到:
Static image generation requires either Kaleido (recommended, supported as of plotly 4.9) or orca (legacy as of plotly 4.9). The kaleido package can be installed using pip.
$ pip install -U kaleido
或康达。
$ conda install -c plotly python-kaleido
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.