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

Skip to content

Commit 455ec14

Browse files
committed
Add Plotly custom mimetype to NB outputs
1 parent 4b45341 commit 455ec14

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

plotly/offline/offline.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ def init_notebook_mode(connected=False):
140140
'</script>'
141141
'').format(script=get_plotlyjs())
142142

143-
ipython_display.display(ipython_display.HTML(script_inject))
143+
display_bundle = {
144+
'text/html': script_inject,
145+
'text/vnd.plotly.v1+html': script_inject
146+
}
147+
ipython_display.display(display_bundle, raw=True)
144148
__PLOTLY_OFFLINE_INITIALIZED = True
145149

146150

@@ -346,7 +350,8 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
346350
cls=plotly.utils.PlotlyJSONEncoder))
347351
display_bundle = {
348352
'application/vnd.plotly.v1+json': {'data': data, 'layout': layout},
349-
'text/html': plot_html
353+
'text/html': plot_html,
354+
'text/vnd.plotly.v1+html': plot_html
350355
}
351356
ipython_display.display(display_bundle, raw=True)
352357

0 commit comments

Comments
 (0)