简体   繁体   中英

Heatmap in Jupyter using Plotly

How would I convert this code to work 'offline' in the Jupyter notebook?

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')

Just add

import plotly
plotly.offline.init_notebook_mode()

and plot via

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM