@@ -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 ):
76
+ validate , default_width , default_height , ** kwargs ):
77
77
78
78
figure = tools .return_figure_from_figure_or_data (figure_or_data , validate )
79
79
@@ -121,6 +121,42 @@ 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
+ plotly_html_div = (
126
+ ''
127
+ '<div id="{id}" style="height: {height}; width: {width};" '
128
+ 'class="plotly-graph-div">'
129
+ '</div>'
130
+ '<script type="text/javascript">'
131
+ 'window.PLOTLYENV=window.PLOTLYENV || {{}};'
132
+ 'window.PLOTLYENV.BASE_URL="' + plotly_platform_url + '";'
133
+ '{script}'
134
+ '</script>'
135
+ '' ).format (
136
+ id = plotdivid , script = script ,
137
+ height = height , width = width )
138
+
139
+ return plotly_html_div , plotdivid , width , height
140
+
141
+ else :
142
+ plotly_html_div = (
143
+ ''
144
+ '<div id="{id}" style="height: {height}; width: {width};" '
145
+ 'class="plotly-graph-div">'
146
+ '</div>'
147
+ '<script type="text/javascript">'
148
+ 'require(["plotly"], function(Plotly) {{'
149
+ 'window.PLOTLYENV=window.PLOTLYENV || {{}};'
150
+ 'window.PLOTLYENV.BASE_URL="' + plotly_platform_url + '";'
151
+ '{script}'
152
+ '}});'
153
+ '</script>'
154
+ '' ).format (
155
+ id = plotdivid , script = script ,
156
+ height = height , width = width )
157
+
158
+ return plotly_html_div , plotdivid , width , height
159
+
124
160
plotly_html_div = (
125
161
''
126
162
'<div id="{id}" style="height: {height}; width: {width};" '
@@ -258,7 +294,7 @@ def plot(figure_or_data,
258
294
259
295
plot_html , plotdivid , width , height = _plot_html (
260
296
figure_or_data , show_link , link_text , validate ,
261
- '100%' , '100%' )
297
+ '100%' , '100%' , browser = True )
262
298
263
299
resize_script = ''
264
300
if width == '100%' or height == '100%' :
0 commit comments