@@ -73,7 +73,7 @@ def init_notebook_mode():
73
73
74
74
75
75
def _plot_html (figure_or_data , show_link , link_text ,
76
- validate , default_width , default_height , ** kwargs ):
76
+ validate , default_width , default_height , global_requirejs ):
77
77
78
78
figure = tools .return_figure_from_figure_or_data (figure_or_data , validate )
79
79
@@ -121,15 +121,9 @@ def _plot_html(figure_or_data, show_link, link_text,
121
121
layout = jlayout ,
122
122
config = jconfig )
123
123
124
- if kwargs and kwargs ['browser' ]:
125
- nb = False # function was not called from a notebook
126
- else :
127
- nb = True
128
-
129
- # evaluate whether or not to include lines based on the nb
130
-
131
- optional_line1 = 'require(["plotly"], function(Plotly) {{ ' if nb else ''
132
- optional_line2 = '}});' if nb else ''
124
+ optional_line1 = ('require(["plotly"], function(Plotly) {{ '
125
+ if global_requirejs else '' )
126
+ optional_line2 = '}});' if global_requirejs else ''
133
127
134
128
plotly_html_div = (
135
129
''
@@ -199,7 +193,7 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
199
193
200
194
plot_html , plotdivid , width , height = _plot_html (
201
195
figure_or_data , show_link , link_text , validate ,
202
- '100%' , 525 )
196
+ '100%' , 525 , global_requirejs = True )
203
197
204
198
display (HTML (plot_html ))
205
199
@@ -268,7 +262,7 @@ def plot(figure_or_data,
268
262
269
263
plot_html , plotdivid , width , height = _plot_html (
270
264
figure_or_data , show_link , link_text , validate ,
271
- '100%' , '100%' , browser = True )
265
+ '100%' , '100%' , global_requirejs = False )
272
266
273
267
resize_script = ''
274
268
if width == '100%' or height == '100%' :
0 commit comments