2017-06-14 84 views
0

如何將此代碼轉換爲Jupyter筆記本中的「離線」工作?Jupyter使用Plotly的熱圖

import plotly.plotly as py 
import plotly.graph_objs as go 

trace = go.Heatmap(z=[[1, 20, 30], 
         [20, 1, 60], 
         [30, 60, 1]]) 
data=[trace] 
py.iplot(data, filename='basic-heatmap') 

回答

1

只需通過

plotly.offline.iplot(data, filename='basic-heatmap') 
添加

import plotly 
plotly.offline.init_notebook_mode() 

和情節