Mega Alpha Release!
Support for direct GeoJSON
Python:
import IPython
import json
def geojson(data):
bundle = {}
bundle['application/vnd.geo+json'] = data
IPython.display.display(bundle, raw=True)
import requests
coffee = requests.get("https://bit.ly/coffeeDC").json()
geojson(coffee)
Direct Plotly support
import IPython
import json
def plotize(data, layout=None):
"""Plot with Plotly.js using the Plotly JSON Chart Schema
http://help.plot.ly/json-chart-schema/
"""
if layout is None:
layout = {}
bundle = {}
bundle['application/vnd.plotly.v1+json'] = {
'data': data,
'layout': layout,
}
IPython.display.display(bundle, raw=True)
data = [
{'x': [1999, 2000, 2001, 2002], 'y': [10, 15, 13, 17], 'type': 'scatter'},
{'x': [1999, 2000, 2001, 2002], 'y': [16, 5, 11, 9], 'type': 'scatter'}
]
layout = {
'title': 'How is Plotting, really?',
'xaxis': { 'title': 'Year', 'showgrid': False, 'zeroline': False },
'yaxis': { 'title': 'Percent', 'showline': False }
}
plotize(data, layout)
If you have plotly.py, you can also use plotly.py data and layout tricks using their encoder:
def plotize(data, layout=None):
"""Plot with Plotly.js using the Plotly JSON Chart Schema
http://help.plot.ly/json-chart-schema/
"""
if layout is None:
layout = {}
redata = json.loads(json.dumps(data, cls=plotly.utils.PlotlyJSONEncoder))
relayout = json.loads(json.dumps(layout, cls=plotly.utils.PlotlyJSONEncoder))
bundle = {}
bundle['application/vnd.plotly.v1+json'] = {
'data': redata,
'layout': relayout,
}
IPython.display.display(bundle, raw=True)
Stability fixes
We've got some of those.