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

Skip to content

Commit f0e7be4

Browse files
committed
changed kwargs to a single parameter
1 parent 1b2d712 commit f0e7be4

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

plotly/offline/offline.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def init_notebook_mode():
7373

7474

7575
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):
7777

7878
figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
7979

@@ -121,15 +121,9 @@ def _plot_html(figure_or_data, show_link, link_text,
121121
layout=jlayout,
122122
config=jconfig)
123123

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 ''
133127

134128
plotly_html_div = (
135129
''
@@ -199,7 +193,7 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
199193

200194
plot_html, plotdivid, width, height = _plot_html(
201195
figure_or_data, show_link, link_text, validate,
202-
'100%', 525)
196+
'100%', 525, global_requirejs=True)
203197

204198
display(HTML(plot_html))
205199

@@ -268,7 +262,7 @@ def plot(figure_or_data,
268262

269263
plot_html, plotdivid, width, height = _plot_html(
270264
figure_or_data, show_link, link_text, validate,
271-
'100%', '100%', browser=True)
265+
'100%', '100%', global_requirejs=False)
272266

273267
resize_script = ''
274268
if width == '100%' or height == '100%':

0 commit comments

Comments
 (0)