Python 在没有在线 plotly 帐户的情况下使用 plotly
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37745917/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using plotly without online plotly account
提问by Harnish
Is it possible to use the plotly library to create charts in python without having an online plotly account? I think the code is opensource https://github.com/plotly/plotly.py. I would like to know whether we can use this without an online account.
是否可以在没有在线 plotly 帐户的情况下使用 plotly 库在 python 中创建图表?我认为代码是开源的https://github.com/plotly/plotly.py。我想知道我们是否可以在没有在线帐户的情况下使用它。
回答by Nickil Maveli
Yes, it can be done. The only purpose of having a plotlyaccount is to host the graphs in your plotlyaccount.
是的,这是可以做到的。拥有plotly帐户的唯一目的是在您的plotly帐户中托管图表。
Plotly Offlineallows you to create graphs offline and save them locally. Instead of saving the graphs to a server, your data and graphs will remain in your local system.
Plotly Offline允许您离线创建图形并将其保存在本地。您的数据和图形将保留在本地系统中,而不是将图形保存到服务器。
回答by Sandeep Kadapa
You can work offline without having a plotly account. The plotly version should be 1.9.x series or higher.
你可以离线工作,而无需一个阴谋帐户。plotly 版本应该是 1.9.x 系列或更高。
import numpy as np
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot,iplot
print (__version__) # requires version >= 1.9.0
#Always run this the command before at the start of notebook
init_notebook_mode(connected=True)
import plotly.graph_objs as go
x=np.array([2,5,8,0,2,-8,4,3,1])
y=np.array([2,5,8,0,2,-8,4,3,1])
data = [go.Scatter(x=x,y=y)]
fig = go.Figure(data = data,layout = go.Layout(title='Offline Plotly Testing',width = 800,height = 500,
xaxis = dict(title = 'X-axis'), yaxis = dict(title = 'Y-axis')))
plot(fig,show_link = False)
Your offline plotly library is setup. Reference : Plotly Offline Tutorial
您的离线绘图库已设置。参考:Plotly 离线教程
回答by Brenda Hali
You can use:
您可以使用:
import plotly
plotly.offline.init_notebook_mode(connected=True)
To use Plotly offline.
离线使用 Plotly。
回答by hui chen
The offline package is great for non-subscribed users but the figure quality is noticeably lower than the online version. This could be a problem if you want to save the figure and share with others.
离线包非常适合非订阅用户,但图形质量明显低于在线版本。如果您想保存图形并与他人共享,这可能会成为一个问题。

