Anscombe's quartet

In [1]:
import pandas
In [11]:
df = pandas.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/carData/Quartet.csv")
In [12]:
df
Out[12]:
Unnamed: 0 x y1 y2 y3 x4 y4
0 1 10 8.04 9.14 7.46 8 6.58
1 2 8 6.95 8.14 6.77 8 5.76
2 3 13 7.58 8.74 12.74 8 7.71
3 4 9 8.81 8.77 7.11 8 8.84
4 5 11 8.33 9.26 7.81 8 8.47
5 6 14 9.96 8.10 8.84 8 7.04
6 7 6 7.24 6.13 6.08 8 5.25
7 8 4 4.26 3.10 5.39 19 12.50
8 9 12 10.84 9.13 8.15 8 5.56
9 10 7 4.82 7.26 6.42 8 7.91
10 11 5 5.68 4.74 5.73 8 6.89
In [16]:
df.drop('Unnamed: 0', axis=1)
Out[16]:
x y1 y2 y3 x4 y4
0 10 8.04 9.14 7.46 8 6.58
1 8 6.95 8.14 6.77 8 5.76
2 13 7.58 8.74 12.74 8 7.71
3 9 8.81 8.77 7.11 8 8.84
4 11 8.33 9.26 7.81 8 8.47
5 14 9.96 8.10 8.84 8 7.04
6 6 7.24 6.13 6.08 8 5.25
7 4 4.26 3.10 5.39 19 12.50
8 12 10.84 9.13 8.15 8 5.56
9 7 4.82 7.26 6.42 8 7.91
10 5 5.68 4.74 5.73 8 6.89
In [24]:
import matplotlib.pyplot as pl
In [25]:
pl.plot(df['x'], df['y1'], '.')
Out[25]:
[<matplotlib.lines.Line2D at 0x1a50e6edda0>]
In [26]:
pl.plot(df['x'], df['y2'], '.')
Out[26]:
[<matplotlib.lines.Line2D at 0x1a50e7592b0>]
In [27]:
pl.plot(df['x'], df['y3'], '.')
Out[27]:
[<matplotlib.lines.Line2D at 0x1a50e7b9278>]
In [28]:
pl.plot(df['x'], df['y4'], '.')
Out[28]:
[<matplotlib.lines.Line2D at 0x1a50e819898>]
In [30]:
import seaborn as sns
sns.set(style="ticks")

# Load the example dataset for Anscombe's quartet
df = sns.load_dataset("anscombe")

# Show the results of a linear regression within each dataset
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data=df,
           col_wrap=2, ci=None, palette="muted",
           scatter_kws={"s": 50, "alpha": 1})
Out[30]:
<seaborn.axisgrid.FacetGrid at 0x1a50f7e22b0>
In [ ]: