The Datasaurus Dozen

Open in Colab  run this example as a notebook — or grab the .ipynb (also linked at the bottom of the page)

The “Datasaurus Dozen” (Matejka & Fitzmaurice, 2017) is a set of 13 datasets that share nearly identical summary statistics (means, standard deviations, and correlations) but look wildly different when plotted. hyp.load(‘datasaurus’) returns the datasets as a list of pandas DataFrames; here we plot all thirteen side by side, one panel per dataset (panels=True), as 2D scatter plots of small black dots (the . point marker) to show why it always pays to visualize your data.

Dataset 1, Dataset 2, Dataset 3, Dataset 4, Dataset 5, Dataset 6, Dataset 7, Dataset 8, Dataset 9, Dataset 10, Dataset 11, Dataset 12, Dataset 13
Dataset 1: mean=(54.27, 47.83), sd=(16.77, 26.94), r=-0.06
Dataset 2: mean=(54.27, 47.83), sd=(16.77, 26.94), r=-0.07
Dataset 3: mean=(54.27, 47.84), sd=(16.76, 26.93), r=-0.07
Dataset 4: mean=(54.26, 47.83), sd=(16.77, 26.94), r=-0.06
Dataset 5: mean=(54.26, 47.84), sd=(16.77, 26.93), r=-0.06
Dataset 6: mean=(54.26, 47.83), sd=(16.77, 26.94), r=-0.06
Dataset 7: mean=(54.27, 47.84), sd=(16.77, 26.94), r=-0.07
Dataset 8: mean=(54.27, 47.84), sd=(16.77, 26.94), r=-0.07
Dataset 9: mean=(54.27, 47.83), sd=(16.77, 26.94), r=-0.07
Dataset 10: mean=(54.27, 47.84), sd=(16.77, 26.93), r=-0.06
Dataset 11: mean=(54.27, 47.84), sd=(16.77, 26.94), r=-0.07
Dataset 12: mean=(54.27, 47.83), sd=(16.77, 26.94), r=-0.07
Dataset 13: mean=(54.26, 47.84), sd=(16.77, 26.93), r=-0.07

# Code source: Contextual Dynamics Laboratory
# License: MIT

import hypertools as hyp

datasets = hyp.load('datasaurus')

for i, df in enumerate(datasets):
    print(f'Dataset {i + 1}: mean=({df.x.mean():.2f}, {df.y.mean():.2f}), '
          f'sd=({df.x.std():.2f}, {df.y.std():.2f}), '
          f'r={df.x.corr(df.y):.2f}')

# small black dots via the '.' point marker; one panel per dataset, laid
# out automatically (3 rows of 5 here), sharing one pipeline fit (a no-op here since
# ndims=2 already matches the data)
fig = hyp.plot(datasets, '.', color='k', ndims=2, panels=True,
               title=[f'Dataset {i + 1}' for i in range(len(datasets))])

Total running time of the script: (0 minutes 0.655 seconds)

Gallery generated by Sphinx-Gallery