I’m having some trouble using plotly in offline mode from within Jupyter notebook. First, my sample code:
from plotly.offline import plot, iplot, init_notebook_mode
import plotly.graph_objs as go
# Make plotly work with Jupyter notebook
init_notebook_mode()
keys=['one','two','three']
values=[1,2,3]
iplot({
"data": [go.Bar(x=keys, y=values)],
"layout": go.Layout(title="Sample Bar Chart")
})
When I run this, I get no errors. The cell expands to include size for the graph, but it’s just blank white space with no bars, axes, labels or anything. When I adapt the same code to online mode or offline with output to a file, it all works as expected. Is there something I’m doing wrong, or just an issue with compatibility with the latest version of Jupyter?
Thanks, Etienne. I did try that with my sample code, and for some reason I still couldn’t get it to show anything but a blank space. I even went so far as to restart the Python2 kernel, just to make sure I wasn’t caching something. I think I can make do with online mode for now, but if there’s anything you’d like me to try to help test the fix, just let me know.
Hi,
I have the same problem. I have tried to roll back to jupyter_core 4.1.0, but I still have the problem.
I have tried to add ‘init_notebook_mode(connected=True)’, but does not work.
had the same problem and updating fixed it for me yesterday, today the graphs are missing again. I’ve restarted the kernel and the server, no change (plotly version 1.12.18, jupyter version 4.1.0, ipython version 4.2.0). Any suggestions? Thanks.
so, creating a new notebook with the same code made the graphs appear. Chelsea had suggested it may be that an old version of plotly.js was cached in my notebook. It still seems odd to me that the update would work and then not work with the same browser/file, but I’m happy to have it working again. Thanks for your help.