Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 283ba58

Browse files
committed
Merge pull request plotly#379 from joshburkart/patch-1
Change to offline.init_notebook_mode()
2 parents e3b0167 + 577177c commit 283ba58

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

plotly/offline/offline.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,16 @@ def init_notebook_mode():
6060
from IPython.display import HTML, display
6161

6262
global __PLOTLY_OFFLINE_INITIALIZED
63+
if not __PLOTLY_OFFLINE_INITIALIZED:
64+
display(HTML('<script type="text/javascript">' +
65+
# ipython's includes `require` as a global, which
66+
# conflicts with plotly.js. so, unrequire it.
67+
'require=requirejs=define=undefined;' +
68+
'</script>' +
69+
'<script type="text/javascript">' +
70+
get_plotlyjs() +
71+
'</script>'))
6372
__PLOTLY_OFFLINE_INITIALIZED = True
64-
display(HTML('<script type="text/javascript">' +
65-
# ipython's includes `require` as a global, which
66-
# conflicts with plotly.js. so, unrequire it.
67-
'require=requirejs=define=undefined;' +
68-
'</script>' +
69-
'<script type="text/javascript">' +
70-
get_plotlyjs() +
71-
'</script>'))
7273

7374

7475
def _plot_html(figure_or_data, show_link, link_text,

0 commit comments

Comments
 (0)