Iris

This notebook loads the Iris data (attributes of flower species) and displays a few scatterplots with Candela.


In [1]:
try:
    import pycandela
except ImportError:
    # Import hack for when in the pycandela source tree.
    import sys
    sys.path.append('..')
    import pycandela


Scatterplot matrix of JSON data

Candela supports the list-of-records data format, for example [{'x': 0, 'y': 0},{'x': 1, 'y': 2}, ...].


In [2]:
import requests
data = requests.get('https://raw.githubusercontent.com/vega/vega-datasets/gh-pages/data/iris.json').json()

pycandela.components.ScatterPlotMatrix(
    data=data, color='species', fields=['sepalLength', 'sepalWidth', 'petalLength', 'petalWidth'], width=800)


Scatterplot of a DataFrame

The data may also be sent to Candela as a pandas DataFrame.


In [3]:
from pandas import DataFrame
df = DataFrame.from_records(data)

pycandela.components.ScatterPlot(data=df, color='species', x='sepalLength', y='sepalWidth')



In [ ]: