Reddspark
Reddspark

Reputation: 7577

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

Upvotes: 0

Views: 1106

Answers (1)

Maximilian Peters
Maximilian Peters

Reputation: 31739

Just add

import plotly
plotly.offline.init_notebook_mode()

and plot via

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

Upvotes: 1

Related Questions