2016-06-10 74 views
9

是否有可能使用剧情库创建图表在python没有一个在线情节帐户?我认为该代码是开源https://github.com/plotly/plotly.py。我想知道我们是否可以在没有在线帐户的情况下使用它。使用情节没有网上情节帐户

+0

是有可能使用脱机plotly库。你也可以参考这个教程:https://github.com/SayaliSonawane/Plotly_Offline_Python –

回答

11

是的,它可以做到。拥有plotly帐户的唯一目的是将这些图表托管在您的plotly帐户中。

Plotly Offline允许您离线创建图形并将其保存到本地。您的数据和图形将保留在本地系统中,而不是将图形保存到服务器。

+1

好吧。谢谢。 – Harnish

+0

如何创建3D图?没有解释... – Alex

0

您可以离线工作,而不需要有一个阴谋帐户。 剧情版本应该是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) 

您的离线情节图书馆设置。 参考:Plotly Offline Tutorial

This the offline graph that is created and you check the there is no online url because the graph is stored in local directory

+0

似乎并没有工作!再次出现同样的错误... – Alex

+0

@Alex检查答案的更新,它会在html文件中创建一个本地图形,如图所示 –