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()
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.