Regression Analysis of Anscombe’s Data

Seaborn has Anscombe’s quartet built-in. For each dataset in the quartet, visualize a regression line. Demonstrate how each dataset is different even if they have similar regression lines.

Example Output:

Utilize sns.lmplot and set the col parameter to ‘dataset’ to plot for each dataset in Anscombe’s quartet.

import seaborn as sns
import matplotlib.pyplot as plt

def plot_anscombe():
    anscombe_data = sns.load_dataset('anscombe')
    sns.lmplot(x="x", y="y", data=anscombe_data, col="dataset", ci=None)
    plt.show()

plot_anscombe()

 

© Let’s Data Science

LOGIN

Unlock AI & Data Science treasures. Log in!