I'm following the tutorial plotly timeseries, here. I've also amended the code to allow for offline charts in Jupyter, here.
I'm trying to plot a timeseries in Jupyter Notebook. I get the following error.
AttributeError: module 'plotly.plotly' has no attribute 'offline'
As far as I can see I've carried out all the instructions but can't get it to work with the method they suggest.
import plotly.plotly as py
import plotly.graph_objs as go
py.offline.init_notebook_mode()
data = [go.Scatter(x=dataload.date, y=dataload.spend)]
py.offline.iplot(data)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-14-c9b2e8d8907c> in <module>()
2 import plotly.graph_objs as go
3
----> 4 py.offline.init_notebook_mode()
5
6 data = [go.Scatter(x=dataload.date, y=dataload.spend)]
AttributeError: module 'plotly.plotly' has no attribute 'offline'
Does anyone have a suggestion to why I might be getting this error, could it be a local setup issue?
Just use:
import plotly
plotly.offline.init_notebook_mode()
don't use: import plotly.plotly as py
You are referring different documentation. Use https://plot.ly/python/getting-started/#initialization-for-offline-plotting Here it also provides more information regarding how to use help function.
For tutorial in offline mode: https://github.com/SayaliSonawane/Plotly_Offline_Python
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With