If you are viewing this file in preview mode, some links won't work. Find the fully featured Jupyter Notebook file on the website of Prof. Jens Flemming at Zwickau University of Applied Sciences. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Seaborn

Seaborn is a Python library based on Matplotlib. It provides two useful features:

The reason for importing as sns is somewhat vague. sns are the initials of Samuel Norman Seaborn, a fictional television character. See also issue #229 in Seaborns Github repository.

Styles for Matplotlib plots

Seaborn styles are loaded by calling sns.set_style() with one of the following string arguments: darkgrid, whitegrid, dark, white, ticks. Subsequent calls to Matplotlib functions will create plots in Seaborn style.

Seaborn also supports different scalings for different usecases. Scaling is set with sns.set_context and one of the string arguments paper, notebook, talk, poster, where notebook is the default. Different scalings allow for almost identical code to create figures for different channels of publication.

Plots for exploring datasets

Seaborn comes with lots of functions which take a whole dataset (Pandas data frame) and create complex visualizations of the dataset. To get an overview have a look at the official Seaborn tutorials and at the Seaborn gallery.

Exercises