Skip to content

Commit

Permalink
Add Plotly custom mimetype to NB outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
tarzzz committed Mar 15, 2017
1 parent 4b45341 commit 455ec14
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plotly/offline/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def init_notebook_mode(connected=False):
'</script>'
'').format(script=get_plotlyjs())

ipython_display.display(ipython_display.HTML(script_inject))
display_bundle = {
'text/html': script_inject,
'text/vnd.plotly.v1+html': script_inject
}
ipython_display.display(display_bundle, raw=True)
__PLOTLY_OFFLINE_INITIALIZED = True


Expand Down Expand Up @@ -346,7 +350,8 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly',
cls=plotly.utils.PlotlyJSONEncoder))
display_bundle = {
'application/vnd.plotly.v1+json': {'data': data, 'layout': layout},
'text/html': plot_html
'text/html': plot_html,
'text/vnd.plotly.v1+html': plot_html
}
ipython_display.display(display_bundle, raw=True)

Expand Down

0 comments on commit 455ec14

Please sign in to comment.