Member-only story

Matplotlib Cheat Sheet

Basic plots, include code samples.

XuanKhanh Nguyen
Towards Data Science
14 min readJul 29, 2020

--

Matplotlib is a plotting library for the Python programming language. The most used module of Matplotib is Pyplot which provides an interface like Matlab but instead, it uses Python and it is open source.

In this note, we will focus on basic Matplotlib to help visualize our data. This is not a comprehensive list but contains common types of data visualization formats. Let’s hop to it!

The structure of this note:

  1. Anatomy of Matplotlib Figure
  2. Start with Pyplot
  3. Chart Types

Anatomy of Matplotlib Figure

Anatomy of a Figure (Image by Author)

A figure contains the overall window where plotting happens.

Axes: It is what we generally think of as a plot. Each Axes has a title, an x-label, and a y-label.

Note: We can have more than one Axes in a figure which helps in building multiple plots.

--

--

Towards Data Science
Towards Data Science

Published in Towards Data Science

Your home for data science and AI. The world’s leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.

XuanKhanh Nguyen
XuanKhanh Nguyen

Written by XuanKhanh Nguyen

Interests: Data Science, Machine Learning, AI, Stats, Python | Minimalist | A fan of odd things.

Responses (4)