I have a file plotting.py where I defined couple of functions to plot some graphs. When I call one of the functions in ipython notebook, nothing happens. When I copy the exact code and execute it in the ipython, it works.
This is an example function:
import plotly.graph_objs as go import plotly.plotly as py def display_test(): import plotly.graph_objs as go import plotly.plotly as py trace0 = go.Scatter( x=[1, 2, 3, 4], y=[10, 15, 13, 17] ) trace1 = go.Scatter( x=[1, 2, 3, 4], y=[16, 5, 11, 9] ) data = go.Data([trace0, trace1]) py.iplot(data, filename = 'basic-line')
I am not using the offline ipython mode.
When I use at the last line
py.plot(data, filename = 'basic-line'), I get opened the figure in the plot.ly webpage. That works from both the function and directly from the code. But I want to display the figure as an output of a notebook cell.
Btw. what is the best of sharing the notebooks with plot.ly graphs? When I use the notebook in the offline mode and use http://nbviewer.jupyter.org/ to view it, the plot.ly graphs are not showed. That’s actually why I am using it in the ‘real-time’ mode.
Thank you for help!