Creating beautiful statistical plots with seaborn
matplotlib comes with a high-level plotting API called pyplot. Inspired by MATLAB (a widespread commercial software for numerical computing), this interface may be a bit too low-level for scientists, in that it can lead to boilerplate code that is difficult to read and maintain. Yet, it is probably one of the most widely used plotting interfaces in the scientific Python community.
There exist higher-level, more convenient plotting interfaces. In this recipe, we present seaborn created by Michael Waskom. This library exposes a high-level plotting API that is specifically adapted to statistical figures. It also integrates nicely with pandas.
Getting ready
You will find the installation instructions of seaborn on the project's page at http://github.com/mwaskom/seaborn. You can just type pip install seaborn
in a terminal.
How to do it…
Let's import NumPy, matplotlib, and seaborn:
In [1]: import numpy as np import matplotlib.pyplot as plt ...