This is one of the 100 recipes of the IPython Cookbook, the definitive guide to high-performance scientific computing and data science in Python.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
x1 = np.random.randn(80)
x2 = np.random.randn(80)
x3 = x1 * x2
y1 = .5 + 2 * x1 - x2 + 2.5 * x3 + 3 * np.random.randn(80)
y2 = .5 + 2 * x1 - x2 + 2.5 * np.random.randn(80)
y3 = y2 + np.random.randn(80)
plt.figure(figsize=(4,3));
sns.violinplot([x1,x2, x3]);
regplot
) to perform and display a linear regression between two variables.plt.figure(figsize=(4,3));
sns.regplot(x2, y2);
DataFrame
.df = pd.DataFrame(dict(x1=x1, x2=x2, x3=x3,
y1=y1, y2=y2, y3=y3))
sns.corrplot(df);
You'll find all the explanations, figures, references, and much more in the book (to be released later this summer).
IPython Cookbook, by Cyrille Rossant, Packt Publishing, 2014 (500 pages).