The Logic Behind Matplotlib & Seaborn

Posted by Xiaoye's Blog on June 13, 2020

TOC

  1. TOC
  2. Introduction
  3. Matplotlib
  4. Seaborn
  5. Reference

Introduction

Seaborn is a Python package to make statistical graph. It’s built on matplotlib and is closely intergrated with pandas package. Of course, we don’t need to know it’s design logic in order to use it. However, if we know the design logic behind seaborn, it’ll be easy to find a visualization solution with seaborn when facing a problem.

Matplotlib

Notes about two types of interface:

  1. Object-Oriented API: this module utilzes the instance of axes.Axes to render the visualization on the instance of figure.Figure.
  2. State-based interface - Pyplot: this module is based on MATLAB, and this module is encapsulated within the matplotlib.pyplot module.

Two things to keep in mind:

  1. Axes represents a individual plot
  2. Figure is the final image which can contain one or more Axes.

Seaborn

There are four types of “figure-level” functions in seaborn which are: sns.relplot(), sns.catplot(), sns.joinplot() and sns.pairplot(). These high level functions are building on two basic categories of functions: ‘axes-level’ functions and axes grids. Below is a mind-mapping of these logic:

Reference

  1. Matplotlib Official Cheatsheets
  2. Matplotlib Object-oriented API VS Pyplot
  3. Official Seaborn Toturial
  4. Overviews of Seaborn Functions
  5. An Introduction to Seaborn