Skip to content

Commit 1389703

Browse files
authored
Merge pull request #713 from plotly/custom-plotly-mimetype-to-outputs
Add Plotly custom mimetype to NB outputs.
2 parents 4b45341 + 930c85a commit 1389703

File tree

5 files changed

+862
-131
lines changed

5 files changed

+862
-131
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
66

7+
## [2.0.6] - 2017-03-20
8+
## Added
9+
- Added a new mimetype 'text/vnd.plotly.v1+html' for `iplot` outputs.
10+
711
## [2.0.5] - 2017-03-07
812
## Fixed
913
- `import plotly` was broken in `2.0.3` and `2.0.2` because the new `dashboard_objs` wasn't included in our `setup.py`'s "`packages`". Now it is and `import plotly` and the other features introduced in `2.0.3` and `2.0.2` should work.

Diff for: plotly/graph_objs/graph_objs.py

+28-12
Original file line numberDiff line numberDiff line change
@@ -983,9 +983,9 @@ class Data(PlotlyList):
983983
Valid items for 'data' at path [] under parents ():
984984
['Area', 'Bar', 'Box', 'Candlestick', 'Choropleth', 'Contour',
985985
'Heatmap', 'Heatmapgl', 'Histogram', 'Histogram2d',
986-
'Histogram2dcontour', 'Mesh3d', 'Ohlc', 'Pie', 'Pointcloud', 'Scatter',
987-
'Scatter3d', 'Scattergeo', 'Scattergl', 'Scattermapbox',
988-
'Scatterternary', 'Surface']
986+
'Histogram2dcontour', 'Mesh3d', 'Ohlc', 'Parcoords', 'Pie',
987+
'Pointcloud', 'Scatter', 'Scatter3d', 'Scattergeo', 'Scattergl',
988+
'Scattermapbox', 'Scatterternary', 'Surface']
989989
990990
"""
991991
_name = 'data'
@@ -1416,9 +1416,10 @@ class Line(PlotlyDict):
14161416
"""
14171417
Valid attributes for 'line' at path [] under parents ():
14181418
1419-
['autocolorscale', 'cauto', 'cmax', 'cmin', 'color', 'colorscale',
1420-
'colorsrc', 'dash', 'outliercolor', 'outlierwidth', 'reversescale',
1421-
'shape', 'showscale', 'simplify', 'smoothing', 'width', 'widthsrc']
1419+
['autocolorscale', 'cauto', 'cmax', 'cmin', 'color', 'colorbar',
1420+
'colorscale', 'colorsrc', 'dash', 'outliercolor', 'outlierwidth',
1421+
'reversescale', 'shape', 'showscale', 'simplify', 'smoothing', 'width',
1422+
'widthsrc']
14221423
14231424
Run `<line-object>.help('attribute')` on any of the above.
14241425
'<line-object>' is the object at []
@@ -1494,6 +1495,20 @@ class Ohlc(PlotlyDict):
14941495
_name = 'ohlc'
14951496

14961497

1498+
class Parcoords(PlotlyDict):
1499+
"""
1500+
Valid attributes for 'parcoords' at path [] under parents ():
1501+
1502+
['dimensions', 'domain', 'hoverinfo', 'legendgroup', 'line', 'name',
1503+
'opacity', 'showlegend', 'stream', 'type', 'uid', 'visible']
1504+
1505+
Run `<parcoords-object>.help('attribute')` on any of the above.
1506+
'<parcoords-object>' is the object at []
1507+
1508+
"""
1509+
_name = 'parcoords'
1510+
1511+
14971512
class Pie(PlotlyDict):
14981513
"""
14991514
Valid attributes for 'pie' at path [] under parents ():
@@ -1547,12 +1562,13 @@ class Scatter(PlotlyDict):
15471562
"""
15481563
Valid attributes for 'scatter' at path [] under parents ():
15491564
1550-
['connectgaps', 'dx', 'dy', 'error_x', 'error_y', 'fill', 'fillcolor',
1551-
'hoverinfo', 'hoveron', 'ids', 'idssrc', 'legendgroup', 'line',
1552-
'marker', 'mode', 'name', 'opacity', 'r', 'rsrc', 'showlegend',
1553-
'stream', 't', 'text', 'textfont', 'textposition', 'textpositionsrc',
1554-
'textsrc', 'tsrc', 'type', 'uid', 'visible', 'x', 'x0', 'xaxis',
1555-
'xcalendar', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'ysrc']
1565+
['connectgaps', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x',
1566+
'error_y', 'fill', 'fillcolor', 'hoverinfo', 'hoveron', 'ids',
1567+
'idssrc', 'legendgroup', 'line', 'marker', 'mode', 'name', 'opacity',
1568+
'r', 'rsrc', 'showlegend', 'stream', 't', 'text', 'textfont',
1569+
'textposition', 'textpositionsrc', 'textsrc', 'tsrc', 'type', 'uid',
1570+
'visible', 'x', 'x0', 'xaxis', 'xcalendar', 'xsrc', 'y', 'y0', 'yaxis',
1571+
'ycalendar', 'ysrc']
15561572
15571573
Run `<scatter-object>.help('attribute')` on any of the above.
15581574
'<scatter-object>' is the object at []

Diff for: plotly/offline/offline.py

+7-2
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)