facha
facha

Reputation: 12502

Offline plot.ly won't work from jupyter notebook

I'm trying to get started with plot.ly (python api) with this code that I'm running from a jupyter notebook:

from plotly.offline import download_plotlyjs, init_notebook_mode
init_notebook_mode(connected=True)

I'm getting this error:

Javascript error adding output!
ReferenceError: Can't find variable: requirejs
See your browser Javascript console for more details.

I've opened js console and I'm seeing these errors:

enter image description here

Upvotes: 1

Views: 1177

Answers (1)

Josmoor98
Josmoor98

Reputation: 1811

Assuming you have already installed plotly using $ pip install plotly the following should be sufficient to get you started. This is currently working in my Jupyter Notebook to plot offline.

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

py.init_notebook_mode(connected=True) # Initialise offline ploytly environment

Follow along with one of their simple scatter plots to check everything is working. using py.iplot will display the plot as an output within your notebook, while py.plot will display the plot in a new tab.

Upvotes: 3

Related Questions