Does anyone know how to use plotly
inside jupyter notebook
using python?
The documentation is not very well organized, at least not from my point of view.
For example, I can run the following code, but it generates a graph in an HTML file, which can be accessed in OUTSIDE jupyter notebook
. Is there a way for the graph to display inside the laptop?
What is also not clear to me (as the documentation leaves much to be desired) is that is credentials required to use plotly
for graphs inside jupyter notebook
? Credentials are only needed to host plots in their cloud and nothing more?
I also found that there is no real cufflinks
documentation. All he says makes it easy to use plotly
with pandas
dataframes. But for those who are not a developer, it would be nice if there were detailed documentation on why this is necessary and what exactly it does that makes life easier.
import plotly.plotly as py from plotly.graph_objs import * trace0 = Scatter( x=[1, 2, 3, 4], y=[10, 15, 13, 17] ) trace1 = Scatter( x=[1, 2, 3, 4], y=[16, 5, 11, 9] ) data = Data([trace0, trace1]) plotly.offline.plot(data, filename = 'basic-line') /Users/blahblah/anaconda/lib/python2.7/site-packages/plotly/offline/offline.py:433: UserWarning: Your filename `basic-line` didn't end with .html. Adding .html to the end of your file. 'file:
If I changed the last line in the code to:
py.iplot(data, filename = 'basic-line')
I get a credential error:
PlotlyLocalCredentialsError: Couldn't find a 'username', 'api-key' pair for you on your local machine. To sign in temporarily (until you stop running Python), run: >>> import plotly.plotly as py >>> py.sign_in('username', 'api_key') Even better, save your credentials permanently using the 'tools' module: >>> import plotly.tools as tls >>> tls.set_credentials_file(username='username', api_key='api-key') For more help, see https://plot.ly/python.
UPDATE:
I tried to execute pandas examples as described here .
I get validation errors for all df.iplot()
or Series.iplot()
.
Can someone explain why I get validation errors despite using iplot ().
There is also no useful documentation regarding cufflinks
.
The plot.ly
documentation is one of the worst I've seen. The organization is a mess and not very friendly for example.