def init_notebook_mode(connected=False):
 if (not ipython):
  raise ImportError('`iplot` can only run inside an IPython Notebook.')
 global __PLOTLY_OFFLINE_INITIALIZED
 if connected:
  script_inject = "<script>requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window.Plotly) {{require(['plotly'],function(plotly) {window.Plotly=plotly;});}}</script>"
 else:
  script_inject = "<script type='text/javascript'>if(!window.Plotly){{define('plotly', function(require, exports, module) {{{script}}});require(['plotly'], function(Plotly) {{window.Plotly = Plotly;}});}}</script>".format(script=get_plotlyjs())
 ipython_display.display(ipython_display.HTML(script_inject))
 __PLOTLY_OFFLINE_INITIALIZED = True

def init_notebook_mode ( connected = False ) : if ( not ipython ) : raise ImportError ( '`iplot` can only run inside an IPython Notebook.' ) global __PLOTLY_OFFLINE_INITIALIZED if connected : script_inject = "<script>requirejs.config({paths: { 'plotly': ['https://cdn.plot.ly/plotly-latest.min']},});if(!window.Plotly) {{require(['plotly'],function(plotly) {window.Plotly=plotly;});}}</script>" else : script_inject = "<script type='text/javascript'>if(!window.Plotly){{define('plotly', function(require, exports, module) {{{script}}});require(['plotly'], function(Plotly) {{window.Plotly = Plotly;}});}}</script>" . format ( script = get_plotlyjs ( ) ) ipython_display . display ( ipython_display . HTML ( script_inject ) ) __PLOTLY_OFFLINE_INITIALIZED = True
initialize plotly .