Seaborn demo per Jake VanderPlas below


In [ ]:
from __future__ import print_function, division

%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

In [ ]:
plt.style.use('ggplot')
x = np.linspace(0, 10, 1000)
plt.plot(x, np.sin(x), x, np.cos(x));

In [ ]:
import seaborn as sns
sns.set()
plt.plot(x, np.sin(x), x, np.cos(x));

In [ ]:
data = np.random.multivariate_normal([0, 0], [[5, 2], [2, 2]], size=2000)
data = pd.DataFrame(data, columns=['x', 'y'])

for col in 'xy':
    plt.hist(data[col], density=True, alpha=0.5)
    # old Matplotlib would be    plt.hist(data[col], normed=True, alpha=0.5)

In [ ]:
for col in 'xy':
    sns.kdeplot(data[col], shade=True)

In [ ]:
sns.distplot(data['x']);

In [ ]:
sns.kdeplot(data.x, data.y); # formerly sns.kdeplot(data)

In [ ]:
with sns.axes_style('white'):
    sns.jointplot("x", "y", data, kind='kde');

In [ ]:
with sns.axes_style('white'):
    sns.jointplot("x", "y", data, kind='hex')

In [ ]:
iris = sns.load_dataset("iris")
iris.head()

In [ ]:
tips = sns.load_dataset('tips')
tips.head()

In [ ]:
tips['tip_pct'] = 100 * tips['tip'] / tips['total_bill']

grid = sns.FacetGrid(tips, row="sex", col="time", margin_titles=True)
grid.map(plt.hist, "tip_pct", bins=np.linspace(0, 40, 15));

In [ ]:
with sns.axes_style(style='ticks'):
    g = sns.factorplot("day", "total_bill", "sex", data=tips, kind="box")
    g.set_axis_labels("Day", "Total Bill");

In [ ]:
with sns.axes_style('white'):
    sns.jointplot("total_bill", "tip", data=tips, kind='hex')

In [ ]:
sns.jointplot("total_bill", "tip", data=tips, kind='reg');

In [ ]:
planets = sns.load_dataset('planets')
planets.head()

In [ ]:
with sns.axes_style('white'):
    g = sns.factorplot("year", data=planets, aspect=1.5)
    g.set_xticklabels(step=5)

In [ ]:
with sns.axes_style('white'):
    g = sns.factorplot("year", data=planets, aspect=4.0,
                       hue='method', order=range(2001, 2015), kind="count")
    g.set_ylabels('Number of Planets Discovered')

Scikit-learn tutorial from pycon 2015 Jake VanderPlas here


In [ ]: