Creating statistical plots easily with seaborn

seaborn is a library that builds on top of Matplotlib and Pandas to provide easy-to-use statistical plotting routines. In this recipe, we give a few examples, adapted from the official documentation, of the types of statistical plot that can be created with seaborn.

How to do it...

  1. Let's import NumPy, Matplotlib, and seaborn:
    >>> import numpy as np
        from scipy import stats
        import matplotlib.pyplot as plt
        import seaborn as sns
        %matplotlib inline
  2. seaborn comes with built-in datasets, which are useful when making demos. The tips dataset contains bills and tips for taxi journeys:
    >>> tips = sns.load_dataset('tips')
        tips
  3. seaborn implements easy-to-use functions to visualize the distribution of datasets. Here, ...

Get IPython Interactive Computing and Visualization Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.