2016-06-10 75 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文件中創建一個本地圖形,如圖所示 –